chsrc/Makefile
2024-05-24 20:31:44 +08:00

50 lines
1.0 KiB
Makefile

# ---------------------------------------------------------------
# File : Makefile
# License : GPLv3
# Authors : Aoran Zeng <ccmywish@qq.com>
# Created on : <2023-08-28>
# Last modified : <2024-05-24>
# ---------------------------------------------------------------
CFLAGS = -Iinclude # -Wall
# 只有Windows会定义该变量
ifeq ($(OS), Windows_NT)
CLANG_FLAGS = -Target x86_64-pc-windows-gnu
endif
ifeq ($(CC), clang)
CFLAGS += $(CLANG_FLAGS)
endif
ifeq ($(shell uname), Linux)
CFLAGS += -static
endif
Target = build/chsrc
CI_Build_Name = chsrc
#=======================
all: build_dir
@$(CC) src/chsrc.c $(CFLAGS) -o $(Target)
@echo; echo Compile done using \'$(CC)\' $(CFLAGS)
CI: all
@mv $(Target) $(CI_Build_Name)
build_dir:
@mkdir build
test: $(Target)
./$(Target) list mirror
./$(Target) list target
./$(Target) get ruby
./$(Target) get python
test_xy: build_dir
@$(CC) test/xy.c -o build/xy
@./build/xy
clean:
-@rm *.exe 2>/dev/null
-@rm ./build/* 2>/dev/null