22 lines
448 B
Makefile
22 lines
448 B
Makefile
# Batch Single C file MakeFile
|
|
|
|
# 指定CPU架构 Architecture -> ARCH
|
|
ARCH ?=
|
|
CC = $(ARCH)gcc
|
|
SUFFIX = .c
|
|
CFLAGS += -Wall -g -lzmq -lpthread
|
|
LD =
|
|
|
|
CUR_SOURCE = $(wildcard *$(SUFFIX))
|
|
CUR_TARGETS = $(patsubst %$(SUFFIX), %, $(CUR_SOURCE))
|
|
|
|
all:$(CUR_TARGETS)
|
|
|
|
# %:%.c 是一个表示与目标相同 文件的模式变量
|
|
$(CUR_TARGETS):%:%$(SUFFIX)
|
|
$(CC) $< $(CFLAGS) -o $@ $(LD)
|
|
|
|
# 指定伪目标
|
|
.PHONY:clean all
|
|
clean:
|
|
-rm -rf $(TARGETS)
|