2024-07-09 14:33:23 +08:00
|
|
|
# ------------------------------------------------------------
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
# -------------------------------------------------------------
|
2024-09-04 19:48:19 +08:00
|
|
|
# Build File : Makefile
|
|
|
|
# File Authors : Aoran Zeng <ccmywish@qq.com>
|
|
|
|
# Created On : <2023-08-28>
|
|
|
|
# Last Modified : <2024-09-04>
|
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-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-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
|
|
|
test: $(Target)
|
2024-06-05 15:35:47 +08:00
|
|
|
@perl ./test/cli.pl
|
2024-05-24 16:45:18 +08:00
|
|
|
|
2024-09-04 19:48:19 +08:00
|
|
|
fastcheck: $(Target)
|
|
|
|
@perl ./test/cli.pl fastcheck
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
-@rm chsrc 2>/dev/null
|