-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (31 loc) · 886 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
APP=website
TEMPLATES=tmpl/index.html tmpl/yourip.html tmpl/404_page.html tmpl/req2long.html tmpl/howmake.html tmpl/bounty.html
CC=cc
CFLAGS=-Wall -O2
RM=rm -f
.PHONY: default
default: dev
$(APP): $(APP).o Makefile compile_tmpl.awk
$(CC) $(CFLAGS) -o $(APP) $(APP).o
cp Makefile compile_tmpl.awk static/
$(APP).o: quinelines.gen tmplfuncs.gen
quinelines.gen: $(APP).c
sed 's|^#include "quinelines.gen"$$|***LINES***|; s/\\/\\\\/g; s/"/\\"/g' $(APP).c | awk '{printf "\"%s\",\n", $$0}' > quinelines.gen
tmplfuncs.gen: $(TEMPLATES)
$(RM) tmplfuncs.gen
echo "$(TEMPLATES)" | xargs -n1 awk -f ./compile_tmpl.awk >> tmplfuncs.gen
.PHONY: dev
dev: $(APP)
@echo "=== DEV ./$(APP) ==="
@./$(APP) 8080
.PHONY: run
run: $(APP)
@echo "=== RUN ./$(APP) ==="
@./$(APP)
.PHONY: clean
clean:
$(RM) *.o
$(RM) *.gen
$(RM) $(APP)
$(RM) static/Makefile
$(RM) static/compile_tmpl.awk