49 lines
1006 B
Makefile
49 lines
1006 B
Makefile
-include make.conf
|
|
|
|
BIN = tcpl
|
|
DIST = $(BIN)-$(VERSION)
|
|
|
|
SRC = $(wildcard src/*.c)
|
|
SRC_OBJ = $(SRC:.c=.o)
|
|
|
|
LIB_SRC = $(wildcard lib/*.c)
|
|
LIB_OBJ = $(LIB_SRC:.c=.o)
|
|
|
|
all: $(BIN)
|
|
|
|
$(BIN): $(SRC_OBJ) $(LIB_OBJ)
|
|
$(LD) $(LDFLAGS) -o $@ $(SRC_OBJ) $(LIB_OBJ)
|
|
|
|
src/%.o: src/%.c
|
|
$(CC) $(CFLAGS) -I. -Iinclude -c $< -o $@
|
|
|
|
lib/%.o: lib/%.c
|
|
$(CC) $(CFLAGS) -I. -Iinclude -c $< -o $@
|
|
|
|
dist: clean
|
|
mkdir -p $(DIST)
|
|
cp -R src make.conf Makefile man LICENSE README doc include lib package $(DIST)
|
|
tar -czf $(DIST).tar.gz $(DIST)
|
|
rm -rf $(DIST)
|
|
|
|
check:
|
|
@failed=0; \
|
|
for f in ./t/*; do \
|
|
[ "$$f" = "./t/init.sh" ] && continue; \
|
|
[ -f "$$f" ] || continue; \
|
|
name=$$(basename "$$f"); \
|
|
sh "$$f"; rc=$$?; \
|
|
if [ $$rc -eq 0 ]; then \
|
|
printf '\e[0;32mPASS\e[0m: t/%s\n' "$$name"; \
|
|
else \
|
|
printf '\e[0;31mFAIL\e[0m: t/%s\n' "$$name"; \
|
|
failed=1; \
|
|
fi; \
|
|
done; \
|
|
if [ $$failed -ne 0 ]; then exit 1; fi
|
|
|
|
clean:
|
|
rm -f $(SRC_OBJ) $(LIB_OBJ) $(BIN) *.gz
|
|
|
|
.PHONY: dist clean all check
|