diff options
-rw-r--r-- | Makefile | 56 |
1 files changed, 40 insertions, 16 deletions
@@ -7,22 +7,16 @@ NAME = gistatic MAILING_LIST = public-inbox TRANSLATIONS = pt fr eo CONTRIBLANGS = -LDLIBS_FINAL = $(LDLIBS) -lgit2 -CFLAGS_FINAL = $(CFLAGS) \ - -D_POSIX_C_SOURCE=200809L \ - -DVERSION='"$(VERSION)"' \ - -DDATE='"$(DATE)"' +LDLIBS = -lgit2 .SUFFIXES: .in .t .in: sed -e 's:@VERSION@:$(VERSION):g' -e 's:@DATE@:$(DATE):g' < $< > $@ -.c: - $(CC) $(CFLAGS_FINAL) $(LDFLAGS) -o $@ $< $(LDLIBS_FINAL) - .c.t: - $(CC) $(CFLAGS_FINAL) $(LDFLAGS) -DTEST -o $@ $< $(LDLIBS_FINAL) + $(CC) $(CFLAGS) $(LDFLAGS) -DTEST -o $@ $< $(LDLIBS) + manpages.en.in = \ doc/gistatic.en.1.in @@ -32,23 +26,53 @@ manpages.in = $(manpages.en.in) \ doc/gistatic.eo.1.in manpages = $(manpages.in:.in=) +sources = \ + src/tar.c \ + src/gistatic.c +objects = $(sources:.c=.o) +tests = $(sources:.c=.t) + + +all: src/config.h $(manpages) src/gistatic libgistatic.a + + +src/gistatic: $(objects) src/main.o + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(objects) src/main.o $(LDLIBS) -all: $(manpages) src/gistatic +libgistatic.a: $(objects) + $(AR) $(ARFLAGS) $@ $(objects) -check: all src/gistatic.t src/tar.t +src/config.h: + touch $@ + printf '#ifndef GISTATIC_CONFIG_H\n' >> $@ + printf '#define GISTATIC_CONFIG_H\n\n' >> $@ + printf '#define _POSIX_C_SOURCE 200809L\n' >> $@ + printf '#define VERSION "$(VERSION)"\n' >> $@ + printf '#define DATE "$(DATE)"\n' >> $@ + printf '\n#endif\n' >> $@ + +$(objects): src/config.h +$(tests): src/config.h +src/gistatic.o: src/gistatic.h src/tar.o src/tar.h +src/main.o: src/gistatic.h src/gistatic.o + + +check: all $(tests) rm -f tests/resources/repositories/repo-1/.git rm -f tests/resources/repositories/repo-2/.git ln -s .gitdir tests/resources/repositories/repo-1/.git ln -s .gitdir tests/resources/repositories/repo-2/.git - ./src/gistatic.t - ./src/tar.t - sh tests/integration.sh + for t in $(tests); do ./$$t; done sh tests/assert-catgets.sh src/gistatic.c + sh tests/integration.sh + sh tests/build-sample.sh + sh tests/c-lint.sh src/*.c clean: rm -rf public/ $(manpages) README.*.md CHANGELOG.*.md messages.mo \ - src/gistatic src/gistatic.t src/tar.t vgcore.* \ - tests/resources/repositories/repo-1/.git \ + vgcore.* tmp/ src/config.h \ + src/*.o src/*.t src/gistatic libgistatic.a \ + tests/resources/repositories/repo-1/.git \ tests/resources/repositories/repo-2/.git install: all |