]> git.tuebingen.mpg.de Git - lopsub.git/blobdiff - Makefile
build: Remove duplicate -g in cc command.
[lopsub.git] / Makefile
index 408e3a5ac123dff22cd744a1487e18de3ed53c64..200a7c0d411b5e8cc90c354576d36759a9c63028 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -18,10 +18,18 @@ AR := ar
 GROFF := groff
 CP := cp
 INSTALL := install
-GZIP := gzip -f9
+GZIP := gzip -fn9
 ZCAT := zcat
 
-DATE := $(shell date '+%B %Y')
+DATE_FMT := +%B %Y
+# To get a reproducible build, we use $(SOURCE_DATE_EPOCH) instead of the
+# current time if this variable is set.
+ifdef SOURCE_DATE_EPOCH
+       DATE := $(shell LC_ALL=C date -u -d '@$(SOURCE_DATE_EPOCH)' \
+               '$(DATE_FMT)' 2>/dev/null || LC_ALL=C date -u '$(DATE_FMT)')
+else
+       DATE := $(shell date '$(DATE_FMT)')
+endif
 GIT_VERSION := $(shell ./version-gen.sh)
 PLAIN_VERSION := $(firstword $(subst -, , $(GIT_VERSION)))
 MAJOR_VERSION := $(firstword $(subst ., , $(PLAIN_VERSION)))
@@ -75,7 +83,7 @@ $(lsg_objs) $(liblopsub_objs) $(lopsubex_objs): %.o: %.c
 lopsubgen.o config_file.o:
        $(CC) -g -c -fPIC -o $@ ${@:.o=.c}
 lsg1.o: lsg.c lsg.h
-       $(CC) -g -DSTAGE1 -Wall -g -c $< -o $@
+       $(CC) -g -DSTAGE1 -Wall -c $< -o $@
 %.o: %.c
        $(CC) -Wall -I. -g -c -fPIC -o $@ $<
 
@@ -91,17 +99,14 @@ lopsubex: $(lopsubex_objs) $(REALNAME)
 
 # web
 html := $(addprefix web/, $(addsuffix .html, \
-       index lopsub-api lopsubgen.1 lopsubex.1 $(m4_man_pages)))
-$(html): $(addprefix web/, $(addsuffix .html, header footer))
-
+       index lopsub-api lopsubgen.1 lopsubex.1 $(m4_man_pages:.gz=)))
 www: $(html)
-
-web/lopsub-api.html: lopsub.h.m4
+web/lopsub-api.html: lopsub.h.m4 web/header.html web/footer.html
        $(M4) -DOUTPUT_MODE=HTML web/header.html $(gendoc) \
                $< web/footer.html > $@
 web/index.html: web/lopsub.7.html
        $(LN) -s $(notdir $<) $@
-web/%.html: %.gz
+web/%.html: %.gz web/header.html
        $(CP) web/header.html $@
        $(ZCAT) $< | $(GROFF) -m man -Thtml | sed -e '1,/^<body>/d' >> $@