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-23 03:27:10 +02:00
|
|
|
GEN := gen/prev/scripts.h
|
2022-05-22 09:55:04 +02:00
|
|
|
|
|
|
|
CFLAGS += -Os -MD -Wall -Wextra -Wno-unused-parameter
|
|
|
|
LDFLAGS += -lmagic
|
|
|
|
|
|
|
|
all: ctpv
|
|
|
|
|
|
|
|
options:
|
|
|
|
@echo "CC = $(CC)"
|
|
|
|
@echo "CFLAGS = $(CFLAGS)"
|
|
|
|
@echo "LDFLAGS = $(LDFLAGS)"
|
|
|
|
|
|
|
|
install: ctpv
|
|
|
|
install -d $(BINPREFIX)
|
|
|
|
install $< $(BINPREFIX)
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
$(RM) $(BINPREFIX)/ctpv
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM) ctpv $(OBJ) $(DEP) $(GEN)
|
|
|
|
$(MAKE) -C embed clean
|
|
|
|
|
|
|
|
make_embed:
|
|
|
|
$(MAKE) -C embed
|
|
|
|
|
|
|
|
ctpv: $(OBJ)
|
|
|
|
|
|
|
|
ctpv.c: $(GEN)
|
|
|
|
|
|
|
|
gen/prev/scripts.h: embed/embed $(PRE)
|
|
|
|
@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
|
|
|
|
|
|
|
embed/embed: make_embed
|
|
|
|
@:
|
|
|
|
|
|
|
|
-include $(DEP)
|
|
|
|
|
|
|
|
.PHONY: all options install uninstall clean make_embed
|
|
|
|
|
|
|
|
.DELETE_ON_ERROR:
|