confgen

Config parser generator
git clone git://git.finwo.net/app/confgen
Log | Files | Refs | LICENSE

Makefile (1124B)


      1 # Initial config
      2 # LIBS=
      3 SRC:=
      4 SRC+=$(wildcard src/*.c)
      5 SRC+=$(filter-out src/util/buffer.c, $(wildcard src/*/*.c))
      6 
      7 # Generated
      8 SRC+=src/util/buffer.c
      9 
     10 CFLAGS?=-Wall -s -O2
     11 
     12 INCLUDES:=
     13 INCLUDES+=-I src
     14 
     15 include lib/.dep/config.mk
     16 
     17 CFLAGS+=$(INCLUDES)
     18 
     19 # Which objects to generate before merging everything together
     20 OBJ:=$(SRC:.c=.o)
     21 
     22 BIN=confgen
     23 
     24 .PHONY: default
     25 default: $(BIN)
     26 # default: $(BIN) $(BIN).1
     27 
     28 lib/cozis/tinytemplate/tt:
     29 	$(MAKE) --directory lib/cozis/tinytemplate
     30 
     31 src/util/buffer.h: template/util/buffer.h lib/cozis/tinytemplate/tt template/util/buffer.json
     32 	cat $< | lib/cozis/tinytemplate/tt template/util/buffer.json > $@
     33 
     34 src/util/buffer.c: template/util/buffer.c lib/cozis/tinytemplate/tt src/util/buffer.h template/util/buffer.json
     35 	cat $< | lib/cozis/tinytemplate/tt template/util/buffer.json > $@
     36 
     37 %.o: %.c $(LIBS)
     38 	$(CC) $(CFLAGS) $(@:.o=.c) -D__NAME=\"$(BIN)\" -c -o $@
     39 
     40 $(BIN): $(OBJ)
     41 	$(CC) $(CFLAGS) $(OBJ) -o $@
     42 
     43 # # Build manpage
     44 # $(BIN).1: manpage.1.md
     45 # 	env NAME=$(BIN) envsubst < manpage.1.md | pandoc --standalone --from markdown --to man -o $(BIN).1
     46 
     47 .PHONY: clean
     48 clean:
     49 	rm -f $(OBJ)