Makefile (1028B)
1 .POSIX: 2 SOURCES = plong.c buf.c json.c http.c cpu.c mem.c net.c 3 HEADERS = buf.h json.h http.h cpu.h mem.h net.h minitls.h 4 OBJS = $(SOURCES:.c=.o) 5 PROGRAM = plong 6 LDFLAGS = -lssl -lcrypto 7 CFLAGS = -W -Wall -std=c99 -D_POSIX_C_SOURCE=200809L -fsanitize=address,undefined -g 8 9 all: $(PROGRAM) 10 11 $(PROGRAM): $(OBJS) 12 $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) 13 14 .c.o: 15 $(CC) $(CFLAGS) -c $< -o $@ 16 17 clean: 18 rm -f $(OBJS) 19 20 depend: 21 for i in ${HEADERS} ${SOURCES}; do echo "$$i"; done | sort | uniq | while read i; do \ 22 sed -ne 's!^# *include *"\([^"]*\)".*!'"$$(echo "$$i" | sed -e 's/\.c$$/\.o/')"': '"$$(dirname "$$i" | sed -ne 's!^[^.].*!&/!; T; p; ')"'\1!; T; p' <"$$i"; \ 23 done | sort 24 25 .PHONY: depend all 26 27 buf.o: buf.h 28 cpu.h: json.h 29 cpu.o: cpu.h 30 cpu.o: util.h 31 http.h: buf.h 32 http.h: minitls.h 33 http.o: buf.h 34 http.o: http.h 35 http.o: minitls.h 36 json.h: buf.h 37 json.o: json.h 38 mem.h: json.h 39 mem.o: mem.h 40 net.h: json.h 41 net.o: net.h 42 net.o: util.h 43 plong.o: cpu.h 44 plong.o: http.h 45 plong.o: json.h 46 plong.o: mem.h 47 plong.o: minitls.h 48 plong.o: net.h