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
|
|
|
# ---------------------------------------------------------------
|
|
|
|
|
2023-09-06 20:11:59 +08:00
|
|
|
CFLAGS = # -Wall
|
|
|
|
|
2023-09-12 21:56:31 +08:00
|
|
|
# 只有Windows会定义该变量
|
2023-09-06 20:11:59 +08:00
|
|
|
ifeq ($(OS), Windows_NT)
|
|
|
|
CLANG_FLAGS = -target x86_64-pc-windows-gnu
|
|
|
|
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
|
|
|
|
2023-09-02 20:06:05 +08:00
|
|
|
TARGET = chsrc
|
2023-09-14 21:31:40 +08:00
|
|
|
|
|
|
|
CI_BUILD_NAME = chsrc
|
2023-08-28 22:21:33 +08:00
|
|
|
#=======================
|
|
|
|
|
2023-09-12 21:56:31 +08:00
|
|
|
all:
|
2023-09-06 20:11:59 +08:00
|
|
|
@$(CC) 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
|
|
|
|
@mv chsrc $(CI_BUILD_NAME)
|
|
|
|
|
2023-09-05 09:32:42 +08:00
|
|
|
test: $(TARGET)
|
2023-09-02 20:06:05 +08:00
|
|
|
./$(TARGET) list mirror
|
|
|
|
./$(TARGET) list target
|
|
|
|
./$(TARGET) get ruby
|
|
|
|
./$(TARGET) get python
|
|
|
|
|
2024-05-24 16:33:32 +08:00
|
|
|
test_xy:
|
|
|
|
@mkdir -p build
|
|
|
|
@$(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:
|
|
|
|
-@rm *.exe 2>/dev/null
|
|
|
|
-@rm $(TARGET) 2>/dev/null
|
2024-05-24 16:33:32 +08:00
|
|
|
-@rm ./build/* 2>/dev/null
|