diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-09-02 16:57:47 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-09-02 16:57:47 -0400 |
commit | 5a8d69ea869636e29807955d621fa45d8a21a8d8 (patch) | |
tree | b3cceba43120ce5871ada08f78ea9fc086c4843e /Makefile | |
parent | 39ecba0032be794a1f4d66f61e09e4910270330f (diff) |
flesh out skeleton of process
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 42 |
1 files changed, 16 insertions, 26 deletions
@@ -1,33 +1,23 @@ .POSIX: -.SILENT: all clean .util.mk +CFLAGS=-g -D_POSIX_C_SOURCE=200809L +YFLAGS=-d +LIBS=-ly -ll +PROGRAM=cc +SYMLINKS=c89 c99 lint cflow ctags +OBJECTS=main.o trigraph.o cpp.tab.o link.o +GENERATED=trigraph.c *.tab.c *.tab.h -CFLAGS=-std=gnu99 -D_XOPEN_SOURCE=700 -g +all: $(PROGRAM) $(SYMLINKS) -all: .util.mk - make -f .util.mk --no-print-directory +$(SYMLINKS): $(PROGRAM) + ln -s $(PROGRAM) $@ -deps: clean .util.mk +cpp.tab.c cpp.tab.h: cpp.y + $(YACC) $(YFLAGS) -p cpp -b cpp cpp.y -clean: - [ -f .util.mk ] && make -k --no-print-directory -f .util.mk clean || true - rm -f .util.mk +cc: $(OBJECTS) + $(CC) -o $@ $(OBJECTS) $(LIBS) -.util.mk: . Makefile - printf '.POSIX:\n\n' > $@ - printf '.SUFFIXES: .cat .msg\n\n' >> $@ - printf 'default: all\n\n' >> $@ - printf 'CFLAGS=$(CFLAGS)\n' >> $@ - printf 'UTILITY=%s\n' "$$(basename -s .c $$(grep -l ^main *.c | head -n1))" >> $@ - printf 'SOURCES=%s\n' "$$(ls -1 *.c | tr '\n' ' ')" >> $@ - printf 'HEADERS=%s\n' "$$(ls -1 *.h 2>/dev/null | tr '\n' ' ')" >> $@ - printf 'OBJECTS=%s\n' "$$(ls -1 *.c | sed -e 's/\.c$$/.o/' | tr '\n' ' ')" >> $@ - printf 'L10N=%s\n' "$$(ls -1 *.msg 2>/dev/null | sed -e 's/\.msg$$/\.cat/' | tr '\n' ' ')" >> $@ - printf 'L11N=' >> $@ - sed -ne '/^\/\*\*cat/,/cat\*\*\//p;' *.c | head -n1 | awk '{print $$2 ".cat"}' >> $@ - printf '\n' >> $@ - printf 'all: $$(UTILITY) $$(L10N)\n\n' >> $@ - printf '$$(UTILITY): $$(OBJECTS) $$(HEADERS)\n\n' >> $@ - printf '.msg.cat:\n\tgencat $$@ $$<\n\n' >> $@ - printf ".c.cat:\n\tsed -ne '/^\/\*\*cat/,/cat\*\*\//p;' $$< | grep -v ^/ | grep -v ^\* | gencat \$$@ -\n\n" >> $@ - printf 'clean:\n\trm -f *.o $$(L10N) $$(UTILITY)\n\n' >> $@ +clean: + rm -f $(PROGRAM) $(SYMLINKS) $(GENERATED) *.o |