Commits

Jakub Wilk committed 617076b

Makefile: add install target.

Comments (0)

Files changed (1)

 LDLIBS = @CURSES_LIB@ @ZLIB_LIBS@
 
 prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
 datadir = @datadir@
 datarootdir = @datarootdir@
 dictdir = @dictdir@
 # code
 # ====
 
+executables = pwnsjp pwnsjpi
+
 .PHONY: all
-all: pwnsjp pwnsjpi
+all: $(executables)
 
 pwnsjpi: pwnsjp
 	ln -sf pwnsjp pwnsjpi
 pwnsjp: $(ofiles)
 	$(LINK.c) $(^) $(LOADLIBES) $(LDLIBS) -o $(@)
 
+.PHONY: install
+install: $(executables)
+	echo $(executables) \
+	| xargs -n 1 \
+	| xargs -t -I {} install -D -m 755 {} $(DESTDIR)$(bindir)/{}
+
 $(ofiles): %.o: %.c
 
 include Makefile.dep
 	sed -e 's,&version;,$(version),g' -e 's,&slowin;,$(dictdir)/slo.win,g' $(<) | \
 	$(XSLTPROC) --output $(@) $(docbook_xsl) -
 
+install: install-doc
+
+.PHONY: install-doc
+install-doc:
+	echo $(notdir $(man_files)) \
+	| xargs -n 1 \
+	| xargs -t -I {} install -D doc/{} $(DESTDIR)/man1/{}
+
 endif
 
 # cleaning