ctpv/Makefile

69 lines
1.3 KiB
Makefile
Raw Normal View History

2022-05-22 09:55:04 +02:00
PREFIX := /usr/local
BINPREFIX := $(PREFIX)/bin
2022-06-14 14:50:15 +02:00
MANPREFIX := $(PREFIX)/man/man1
2022-05-22 09:55:04 +02:00
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)
GEN := gen/prev/scripts.h gen/server.h gen/helpers.h
2022-05-22 09:55:04 +02:00
2022-06-12 12:25:43 +02:00
O := -O2
2022-06-09 06:56:37 +02:00
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-06-14 14:50:15 +02:00
install: install.bin install.man
install.bin: 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
2022-06-14 14:50:15 +02:00
install.man: doc/ctpv.1
install -d $(MANPREFIX)
install -m 0644 $^ $(MANPREFIX)
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
gen/prev/scripts.h: $(PRE) embed/embed
2022-05-22 09:55:04 +02:00
@mkdir -p $(@D)
embed/embed -p prev_scr_ $(PRE) > $@
2022-05-22 09:55:04 +02:00
gen/server.h: clear.sh end.sh embed/embed
2022-05-25 23:57:50 +02:00
@mkdir -p $(@D)
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)
2022-06-14 14:50:15 +02:00
.PHONY: all options install install.bin install.man uninstall clean make_embed
2022-05-22 09:55:04 +02:00
.DELETE_ON_ERROR: