comparison Makefile @ 13:5a992d873084

Use a symlink for the manpage alias instead of a soelim stub
author Guido Berhoerster <guido+sencrypt@berhoerster.name>
date Tue, 13 Sep 2016 19:50:38 +0200
parents 14e58decdf87
children a779ed022a87
comparison
equal deleted inserted replaced
12:14e58decdf87 13:5a992d873084
35 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) 35 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS)
36 # X makedepend 36 # X makedepend
37 #MAKEDEPEND.c = makedepend -f- -Y -- $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) -- 37 #MAKEDEPEND.c = makedepend -f- -Y -- $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) --
38 LINK.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH) 38 LINK.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH)
39 LINK.o = $(CC) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH) 39 LINK.o = $(CC) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH)
40 CP := cp
40 INSTALL := install 41 INSTALL := install
41 INSTALL.exec := $(INSTALL) -D -m 0755 42 INSTALL.exec := $(INSTALL) -D -m 0755
42 INSTALL.data := $(INSTALL) -D -m 0644 43 INSTALL.data := $(INSTALL) -D -m 0644
44 INSTALL.link := $(CP) -f -P
43 PAX := pax 45 PAX := pax
44 GZIP := gzip 46 GZIP := gzip
45 SED := sed 47 SED := sed
46 XSLTPROC := xsltproc 48 XSLTPROC := xsltproc
47 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl 49 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
50 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
51 --stringparam man.copyright.section.enabled 0
48 52
49 define generate-manpage-rule = 53 define generate-manpage-rule =
50 %.$(1): %.$(1).xml 54 $(addsuffix .%,$(basename $1)): $(addsuffix .%.xml,$(basename $(firstword $1))) docbook-update-source-data.xsl
51 $$(XSLTPROC) \ 55 $$(XSLTPROC) \
52 --xinclude \ 56 --xinclude \
53 --stringparam package $$(PACKAGE) \ 57 --stringparam package $$(PACKAGE) \
54 --stringparam version $$(VERSION)\ 58 --stringparam version $$(VERSION) \
55 docbook-update-source-data.xsl $$< | \ 59 docbook-update-source-data.xsl $$< | \
56 $$(XSLTPROC) \ 60 $$(XSLTPROC) \
57 --xinclude \ 61 --xinclude \
62 --output $(firstword $1) \
58 $$(DOCBOOK5_MANPAGES_FLAGS) \ 63 $$(DOCBOOK5_MANPAGES_FLAGS) \
59 --output $$@ \
60 $$(DOCBOOK5_MANPAGES_STYLESHEET) \ 64 $$(DOCBOOK5_MANPAGES_STYLESHEET) \
61 - 65 -
66 for alias in $(wordlist 2,$(words $1),$1); do \
67 ln -sf $(notdir $(firstword $1)) $$$$alias; \
68 done
62 endef 69 endef
63 70
64 DESTDIR ?= 71 DESTDIR ?=
65 prefix ?= /usr/local 72 prefix ?= /usr/local
66 bindir ?= $(prefix)/bin 73 bindir ?= $(prefix)/bin
79 HAVE_ERR_H ?= 1 86 HAVE_ERR_H ?= 1
80 endif 87 endif
81 endif 88 endif
82 89
83 OBJS = sencrypt.o 90 OBJS = sencrypt.o
91
84 MANPAGES = $(PACKAGE).1 $(DECRYPT_ALIAS).1 92 MANPAGES = $(PACKAGE).1 $(DECRYPT_ALIAS).1
85 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
86 --stringparam man.copyright.section.enabled 0
87 93
88 .DEFAULT_TARGET = all 94 .DEFAULT_TARGET = all
89 95
90 .PHONY: all clean clobber dist install 96 .PHONY: all clean clobber dist install
91 97
101 $(PACKAGE): LDLIBS := -lcrypto 107 $(PACKAGE): LDLIBS := -lcrypto
102 $(PACKAGE): XLDFLAGS := $(shell getconf LFS_LDFLAGS) 108 $(PACKAGE): XLDFLAGS := $(shell getconf LFS_LDFLAGS)
103 $(PACKAGE): $(OBJS) 109 $(PACKAGE): $(OBJS)
104 $(LINK.o) $^ $(LDLIBS) -o $@ 110 $(LINK.o) $^ $(LDLIBS) -o $@
105 111
106 $(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section)))) 112 $(eval $(call generate-manpage-rule,$(MANPAGES)))
107 113
108 %.o: %.c 114 %.o: %.c
109 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d 115 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
110 $(COMPILE.c) -o $@ $< 116 $(COMPILE.c) -o $@ $<
111 117
112 install: 118 install:
113 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)" 119 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)"
114 ln -f $(PACKAGE) "$(DESTDIR)$(bindir)/$(DECRYPT_ALIAS)" 120 ln -f $(PACKAGE) "$(DESTDIR)$(bindir)/$(DECRYPT_ALIAS)"
115 for manpage in $(MANPAGES); do \ 121 for manpage in $(MANPAGES); do \
116 $(INSTALL.data) $${manpage} \ 122 if [ -L $${manpage} ]; then \
117 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ 123 $(INSTALL.link) $${manpage} \
124 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \
125 else \
126 $(INSTALL.data) $${manpage} \
127 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \
128 fi \
118 done 129 done
119 130
120 clean: 131 clean:
121 rm -f $(PACKAGE) $(OBJS) $(MANPAGES) 132 rm -f $(PACKAGE) $(OBJS) $(MANPAGES)
122 133