diff options
author | EuAndreh <eu@euandre.org> | 2021-09-05 19:07:58 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-09-05 19:07:58 -0300 |
commit | 2d8bf12a0a7422bdedd6b27e8c1fb7c5202cb798 (patch) | |
tree | f3d53d2dd21aa7cb831cc86c18b66075436b00ea | |
parent | Makefile: Add better .c.o inference rule (diff) | |
download | gistatic-2d8bf12a0a7422bdedd6b27e8c1fb7c5202cb798.tar.gz gistatic-2d8bf12a0a7422bdedd6b27e8c1fb7c5202cb798.tar.xz |
Makefile: Generate src/config.h from src/config.h.in
-rw-r--r-- | Makefile | 21 | ||||
-rw-r--r-- | src/config.h.in | 9 |
2 files changed, 16 insertions, 14 deletions
@@ -10,10 +10,15 @@ CONTRIBLANGS = LDLIBS = -lgit2 -.SUFFIXES: .in .to +.SUFFIXES: +.SUFFIXES: .c .o .to .in .in: - sed -e 's:@VERSION@:$(VERSION):g' -e 's:@DATE@:$(DATE):g' < $< > $@ + sed \ + -e 's:@VERSION@:$(VERSION):g' \ + -e 's:@DATE@:$(DATE):g' \ + -e 's:@NAME@:$(NAME):g' \ + < $< > $@ .c.o: $(CC) $(CFLAGS) -o $@ -c $< @@ -41,7 +46,6 @@ t-objects = $(sources:.c=.to) src/tests-lib.to src/main.to all: libgistatic.a gistatic $(manpages) - libgistatic.a: $(lib-objects) $(AR) $(ARFLAGS) $@ $(lib-objects) @@ -51,17 +55,6 @@ gistatic: libgistatic.a src/main.o gistatic-tests: $(t-objects) $(CC) $(LDFLAGS) -o $@ $(t-objects) $(LDLIBS) -src/config.h: - printf '#ifndef GISTATIC_CONFIG_H\n' >> $@ - printf '#define GISTATIC_CONFIG_H\n' >> $@ - printf '\n' >> $@ - printf '#define _POSIX_C_SOURCE 200809L\n' >> $@ - printf '#define VERSION "$(VERSION)"\n' >> $@ - printf '#define DATE "$(DATE)"\n' >> $@ - printf '#define PROGNAME "$(NAME)"\n' >> $@ - printf '\n' >> $@ - printf '#endif\n' >> $@ - $(all-objects) $(t-objects): src/config.h src/tests-lib.to: src/tests-lib.h src/logerr.o src/logerr.to: src/logerr.h diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..8763524 --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,9 @@ +#ifndef GISTATIC_CONFIG_H +#define GISTATIC_CONFIG_H + +#define _POSIX_C_SOURCE 200809L +#define VERSION "@VERSION@" +#define DATE "@DATE@" +#define PROGNAME "@NAME@" + +#endif |