2022-05-22 09:55:04 +02:00
|
|
|
PREFIX := /usr/local
|
|
|
|
BINPREFIX := $(PREFIX)/bin
|
|
|
|
|
|
|
|
SRC := $(wildcard *.c)
|
|
|
|
OBJ := $(SRC:.c=.o)
|
|
|
|
DEP := $(OBJ:.o=.d)
|
|
|
|
PRE := $(wildcard prev/*.sh)
|
2022-05-25 23:57:50 +02:00
|
|
|
GEN := gen/prev/scripts.h gen/server.h
|
2022-05-22 09:55:04 +02:00
|
|
|
|
|
|
|
CFLAGS += -Os -MD -Wall -Wextra -Wno-unused-parameter
|
2022-05-28 16:07:59 +02:00
|
|
|
LDFLAGS += -lmagic -lcrypto
|
2022-05-22 09:55:04 +02:00
|
|
|
|
|
|
|
all: ctpv
|
|
|
|
|
|
|
|
options:
|
|
|
|
@echo "CC = $(CC)"
|
|
|
|
@echo "CFLAGS = $(CFLAGS)"
|
|
|
|
@echo "LDFLAGS = $(LDFLAGS)"
|
|
|
|
|
2022-05-25 23:57:50 +02:00
|
|
|
install: ctpv ctpvclear
|
2022-05-22 09:55:04 +02:00
|
|
|
install -d $(BINPREFIX)
|
2022-05-25 23:57:50 +02:00
|
|
|
install $^ $(BINPREFIX)
|
2022-05-22 09:55:04 +02:00
|
|
|
|
|
|
|
uninstall:
|
2022-05-26 01:48:27 +02:00
|
|
|
$(RM) $(BINPREFIX)/ctpv $(BINPREFIX)/ctpvclear
|
2022-05-22 09:55:04 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM) ctpv $(OBJ) $(DEP) $(GEN)
|
|
|
|
$(MAKE) -C embed clean
|
|
|
|
|
|
|
|
make_embed:
|
|
|
|
$(MAKE) -C embed
|
|
|
|
|
|
|
|
ctpv: $(OBJ)
|
|
|
|
|
|
|
|
ctpv.c: $(GEN)
|
|
|
|
|
2022-05-25 23:57:50 +02:00
|
|
|
gen/prev/scripts.h: $(PRE) embed/embed helpers.sh
|
2022-05-22 09:55:04 +02:00
|
|
|
@mkdir -p $(@D)
|
2022-05-23 03:27:10 +02:00
|
|
|
embed/embed -p prev_scr_ -h helpers.sh $(PRE) > $@
|
2022-05-22 09:55:04 +02:00
|
|
|
|
2022-05-25 23:57:50 +02:00
|
|
|
gen/server.h: clear.sh end.sh embed/embed helpers.sh
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
embed/embed -p scr_ -h helpers.sh clear.sh end.sh > $@
|
|
|
|
|
2022-05-22 09:55:04 +02:00
|
|
|
embed/embed: make_embed
|
|
|
|
@:
|
|
|
|
|
|
|
|
-include $(DEP)
|
|
|
|
|
|
|
|
.PHONY: all options install uninstall clean make_embed
|
|
|
|
|
|
|
|
.DELETE_ON_ERROR:
|