2022-05-22 09:55:04 +02:00
|
|
|
PREFIX := /usr/local
|
|
|
|
BINPREFIX := $(PREFIX)/bin
|
|
|
|
|
2022-06-08 12:41:30 +02:00
|
|
|
SRC := $(wildcard src/*.c)
|
2022-05-22 09:55:04 +02:00
|
|
|
OBJ := $(SRC:.c=.o)
|
|
|
|
DEP := $(OBJ:.o=.d)
|
|
|
|
PRE := $(wildcard prev/*.sh)
|
2022-05-28 19:33:18 +02:00
|
|
|
GEN := gen/prev/scripts.h gen/server.h gen/helpers.h
|
2022-05-22 09:55:04 +02:00
|
|
|
|
2022-06-09 06:56:37 +02:00
|
|
|
O := -Os
|
|
|
|
LIBS := magic crypto
|
|
|
|
|
|
|
|
CFLAGS += $(O) -MD -Wall -Wextra -Wno-unused-parameter
|
|
|
|
LDFLAGS += $(LIBS:%=-l%)
|
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)
|
2022-06-08 12:41:30 +02:00
|
|
|
$(CC) $(LDFLAGS) $+ -o $@
|
2022-05-22 09:55:04 +02:00
|
|
|
|
2022-06-08 12:41:30 +02:00
|
|
|
src/ctpv.c: $(GEN)
|
2022-05-22 09:55:04 +02:00
|
|
|
|
2022-05-28 19:33:18 +02:00
|
|
|
gen/prev/scripts.h: $(PRE) embed/embed
|
2022-05-22 09:55:04 +02:00
|
|
|
@mkdir -p $(@D)
|
2022-05-28 19:33:18 +02:00
|
|
|
embed/embed -p prev_scr_ $(PRE) > $@
|
2022-05-22 09:55:04 +02:00
|
|
|
|
2022-05-28 19:33:18 +02:00
|
|
|
gen/server.h: clear.sh end.sh embed/embed
|
2022-05-25 23:57:50 +02:00
|
|
|
@mkdir -p $(@D)
|
2022-05-28 19:33:18 +02:00
|
|
|
embed/embed -p scr_ clear.sh end.sh > $@
|
|
|
|
|
|
|
|
gen/helpers.h: helpers.sh embed/embed
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
embed/embed -p scr_ helpers.sh > $@
|
2022-05-25 23:57:50 +02:00
|
|
|
|
2022-05-22 09:55:04 +02:00
|
|
|
embed/embed: make_embed
|
2022-06-09 06:56:37 +02:00
|
|
|
@ # do nothing
|
2022-05-22 09:55:04 +02:00
|
|
|
|
|
|
|
-include $(DEP)
|
|
|
|
|
|
|
|
.PHONY: all options install uninstall clean make_embed
|
|
|
|
|
|
|
|
.DELETE_ON_ERROR:
|