CC = cc CCOPTS = -Wall -std=gnu99 out = upwgen PREFIX = /usr/bin MANPREFIX = /usr/share/man VERSION = 1 PATCHLEVEL = 1 EXTRAVERSION = -rc1 RELDATE = 2019 March 09 VERSTR = "$(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL))$(EXTRAVERSION)" all: @if [ ! -d obj ]; then mkdir obj; fi $(CC) $(CCOPTS) -c src/i18n_cat.c -o obj/i18n_cat.o $(CC) $(CCOPTS) -DVERSTR=$(VERSTR) src/main.c obj/*.o -o $(out) # Interpolate the man page and compress sed \ -e "s/{{ VERSTR }}/$(VERSTR)/" \ -e "s/{{ RELDATE }}/$(RELDATE)/" \ doc/upwgen.1 | gzip -c > upwgen.1.gz install: # Install the binary install -D -m 755 $(out) "$(DESTDIR)/$(PREFIX)/$(out)" # Install the man page install -D -m 644 upwgen.1.gz "$(DESTDIR)/$(MANPREFIX)/man1/upwgen.1.gz"