2023-09-05 20:56:24 +08:00
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# File : Makefile
|
|
|
|
# License : GPLv3
|
|
|
|
# Authors : Aoran Zeng <ccmywish@qq.com>
|
|
|
|
# Created on : <2023-08-28>
|
2024-05-24 16:33:32 +08:00
|
|
|
# Last modified : <2024-05-24>
|
2023-09-05 20:56:24 +08:00
|
|
|
# ---------------------------------------------------------------
|
|
|
|
|
2024-05-24 16:45:18 +08:00
|
|
|
CFLAGS = -Iinclude # -Wall
|
2023-09-06 20:11:59 +08:00
|
|
|
|
2023-09-12 21:56:31 +08:00
|
|
|
# 只有Windows会定义该变量
|
2023-09-06 20:11:59 +08:00
|
|
|
ifeq ($(OS), Windows_NT)
|
2024-05-24 16:45:18 +08:00
|
|
|
CLANG_FLAGS = -Target x86_64-pc-windows-gnu
|
2023-09-06 20:11:59 +08:00
|
|
|
endif
|
2023-09-20 20:29:37 +08:00
|
|
|
ifeq ($(CC), clang)
|
|
|
|
CFLAGS += $(CLANG_FLAGS)
|
|
|
|
endif
|
|
|
|
ifeq ($(shell uname), Linux)
|
|
|
|
CFLAGS += -static
|
|
|
|
endif
|
2023-08-28 22:21:33 +08:00
|
|
|
|
2024-05-24 16:45:18 +08:00
|
|
|
Target = build/chsrc
|
2023-09-14 21:31:40 +08:00
|
|
|
|
2024-05-24 16:45:18 +08:00
|
|
|
CI_Build_Name = chsrc
|
2023-08-28 22:21:33 +08:00
|
|
|
#=======================
|
|
|
|
|
2024-05-24 16:45:18 +08:00
|
|
|
all: build_dir
|
2024-05-24 20:31:44 +08:00
|
|
|
@$(CC) src/chsrc.c $(CFLAGS) -o $(Target)
|
2023-09-20 20:29:37 +08:00
|
|
|
@echo; echo Compile done using \'$(CC)\' $(CFLAGS)
|
2023-08-30 09:54:35 +08:00
|
|
|
|
2023-09-14 21:31:40 +08:00
|
|
|
CI: all
|
2024-05-24 16:45:18 +08:00
|
|
|
@mv $(Target) $(CI_Build_Name)
|
2023-09-14 21:31:40 +08:00
|
|
|
|
2024-05-24 16:45:18 +08:00
|
|
|
build_dir:
|
2024-05-24 20:56:07 +08:00
|
|
|
@mkdir -p build
|
2023-09-02 20:06:05 +08:00
|
|
|
|
2024-05-24 16:45:18 +08:00
|
|
|
test: $(Target)
|
|
|
|
./$(Target) list mirror
|
2024-05-24 20:31:44 +08:00
|
|
|
./$(Target) list target
|
2024-05-24 16:45:18 +08:00
|
|
|
./$(Target) get ruby
|
|
|
|
./$(Target) get python
|
|
|
|
|
|
|
|
test_xy: build_dir
|
2024-05-24 16:33:32 +08:00
|
|
|
@$(CC) test/xy.c -o build/xy
|
|
|
|
@./build/xy
|
2023-09-05 09:32:42 +08:00
|
|
|
|
2023-08-30 09:54:35 +08:00
|
|
|
clean:
|
2024-05-24 20:31:44 +08:00
|
|
|
-@rm *.exe 2>/dev/null
|
2024-05-24 16:33:32 +08:00
|
|
|
-@rm ./build/* 2>/dev/null
|