chsrc/Makefile

60 lines
1.3 KiB
Makefile
Raw Normal View History

2024-12-14 18:59:49 +08:00
# --------------------------------------------------------------
2024-07-09 14:33:23 +08:00
# SPDX-License-Identifier: GPL-3.0-or-later
2024-12-14 18:59:49 +08:00
# --------------------------------------------------------------
2024-09-04 19:48:19 +08:00
# Build File : Makefile
# File Authors : Aoran Zeng <ccmywish@qq.com>
2024-12-14 18:59:49 +08:00
# Contributors : Yangmoooo <yangmoooo@outlook.com>
# |
2024-09-04 19:48:19 +08:00
# Created On : <2023-08-28>
2024-12-14 18:59:49 +08:00
# Last Modified : <2024-12-14>
# --------------------------------------------------------------
2023-09-05 20:56:24 +08:00
2024-12-14 19:54:37 +08:00
CFLAGS = -Iinclude -Ilib # -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-12-09 21:47:56 +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-25 00:53:07 +08:00
Target = 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-25 00:53:07 +08:00
all:
2024-09-10 19:13:25 +08:00
@$(CC) src/chsrc-main.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-12-14 18:59:49 +08:00
test: test-xy test-fw
2024-09-04 19:48:19 +08:00
2024-06-05 13:12:43 +08:00
test-xy:
2024-05-25 01:02:30 +08:00
@$(CC) test/xy.c $(CFLAGS) -o xy
2024-05-25 00:53:07 +08:00
@./xy
2023-09-05 09:32:42 +08:00
2024-12-14 18:59:49 +08:00
test-fw:
@$(CC) test/fw.c $(CFLAGS) -o fw
@./fw
2024-12-23 10:29:47 +08:00
# AUR package 安装时将执行此 target
2024-12-14 18:59:49 +08:00
fastcheck: $(Target)
@perl ./test/cli.pl fastcheck
test-cli: $(Target)
@perl ./test/cli.pl
2023-08-30 09:54:35 +08:00
clean:
2024-05-25 00:53:07 +08:00
-@rm *.exe 2>/dev/null
-@rm xy 2>/dev/null
2024-12-14 18:59:49 +08:00
-@rm fw 2>/dev/null
2024-05-25 00:53:07 +08:00
-@rm chsrc 2>/dev/null
2024-12-14 19:54:37 +08:00
-@rm README.md.bak* 2>/dev/null