]> git.pond.sub.org Git - empserver/commitdiff
(install, install-html): Implement. Closes #913154.
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 23 Dec 2005 17:58:19 +0000 (17:58 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 23 Dec 2005 17:58:19 +0000 (17:58 +0000)
(installdirs): New.

GNUmakefile.in
Make.mk

index ce418f1041ea5bee9ebf07dd73dcb0700a1d744c..e2d4523e8a906307be0e7cc0764dffa885dba699 100644 (file)
@@ -68,6 +68,7 @@ RANLIB := @RANLIB@
 prefix := @prefix@
 exec_prefix := @exec_prefix@
 bindir := @bindir@
 prefix := @prefix@
 exec_prefix := @exec_prefix@
 bindir := @bindir@
+sbindir := @sbindir@
 datadir := @datadir@
 localstatedir := @localstatedir@
 mandir := @mandir@
 datadir := @datadir@
 localstatedir := @localstatedir@
 mandir := @mandir@
@@ -78,13 +79,7 @@ VPATH := @srcdir@
 
 cvs_controlled := @cvs_controlled@
 
 
 cvs_controlled := @cvs_controlled@
 
-# Recursively expanded so that $@ and $< work.
-subst.in = sed \
-       -e 's?@configure_input\@?$(notdir $@).  Generated from $(notdir $<) by GNUmakefile.?g' \
-       -e 's?@econfig\@?$(sysconfdir)/empire/econfig?g' \
-       -e 's?@edatadir\@?$(localstatedir)/empire?g' \
-       -e 's?@einfodir\@?$(datadir)/empire/info.nr?g' \
-       -e 's/@EMPIREHOST\@/@EMPIREHOST@/g' \
-       -e 's/@EMPIREPORT\@/@EMPIREPORT@/g'
+EMPIREHOST := @EMPIREHOST@
+EMPIREPORT := @EMPIREPORT@
 
 include $(srcdir)/Make.mk
 
 include $(srcdir)/Make.mk
diff --git a/Make.mk b/Make.mk
index 98bc6e795a422459b38e61ca5edadea4beb7a02f..b923d1a7d4aa6db99abe28e026865ae323352e1b 100644 (file)
--- a/Make.mk
+++ b/Make.mk
@@ -47,6 +47,8 @@
 dirs := $(sort $(dir $(src)))
 csrc := $(filter %.c, $(src))
 tsrc := $(filter %.t, $(src))
 dirs := $(sort $(dir $(src)))
 csrc := $(filter %.c, $(src))
 tsrc := $(filter %.t, $(src))
+man1 := $(filter man/%.1, $(src))
+man6 := $(filter man/%.6, $(src))
 
 # Info topics and subjects
 -include subjects.mk
 
 # Info topics and subjects
 -include subjects.mk
@@ -62,7 +64,9 @@ obj := $(csrc:.c=.o) $(filter %.o, $(ac:.c=.o))
 deps := $(obj:.o=.d)
 libs := $(addprefix lib/, libcommon.a libgen.a libglobal.a)
 util := $(addprefix src/util/, fairland files pconfig)
 deps := $(obj:.o=.d)
 libs := $(addprefix lib/, libcommon.a libgen.a libglobal.a)
 util := $(addprefix src/util/, fairland files pconfig)
-progs := $(util) src/client/empire src/server/emp_server
+client := src/client/empire
+server := src/server/emp_server
+progs := $(util) $(client) $(server)
 tsubj := $(addprefix info/, $(addsuffix .t, $(subjects)))
 ttop := info/TOP.t
 info.nr := $(addprefix info.nr/, $(info))
 tsubj := $(addprefix info/, $(addsuffix .t, $(subjects)))
 ttop := info/TOP.t
 info.nr := $(addprefix info.nr/, $(info))
@@ -84,6 +88,18 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp
 clean := $(obj) $(deps) $(libs) $(progs) $(empth_lib) $(tsubj) \
 $(info.nr) $(info.html)
 distclean := $(ac) info/stamp $(ttop)
 clean := $(obj) $(deps) $(libs) $(progs) $(empth_lib) $(tsubj) \
 $(info.nr) $(info.html)
 distclean := $(ac) info/stamp $(ttop)
+econfig := $(sysconfdir)/empire/econfig
+edatadir := $(localstatedir)/empire
+einfodir := $(datadir)/empire/info.nr
+ehtmldir := $(datadir)/empire/info.html
+# Recursively expanded so that $@ and $< work.
+subst.in = sed \
+       -e 's?@configure_input\@?$(notdir $@).  Generated from $(notdir $<) by GNUmakefile.?g' \
+       -e 's?@econfig\@?$(econfig)?g' \
+       -e 's?@edatadir\@?$(edatadir)?g' \
+       -e 's?@einfodir\@?$(einfodir)?g' \
+       -e 's/@EMPIREHOST\@/$(EMPIREHOST)/g' \
+       -e 's/@EMPIREPORT\@/$(EMPIREPORT)/g'
 
 # Compiler flags
 CPPFLAGS += -I$(srcdir)/include -Iinclude
 
 # Compiler flags
 CPPFLAGS += -I$(srcdir)/include -Iinclude
@@ -111,11 +127,34 @@ clean:
 distclean: clean
        rm -rf $(distclean)
 
 distclean: clean
        rm -rf $(distclean)
 
-.PHONY: install install-html
-install: all
-       false # FIXME
-install-html: html
-       false # FIXME
+.PHONY: install
+install: all installdirs
+       $(INSTALL_PROGRAM) $(util) $(server) $(sbindir)
+       $(INSTALL_PROGRAM) $(client) $(bindir)
+       $(INSTALL_DATA) $(info.nr) $(einfodir)
+       $(INSTALL_DATA) $(addprefix $(srcdir)/, $(man1)) $(mandir)/man1
+       $(INSTALL_DATA) $(addprefix $(srcdir)/, $(man6)) $(mandir)/man6
+       if test -e $(econfig); then                                     \
+           if src/util/pconfig $(econfig) >$(econfig).new; then        \
+               if cmp -s $(econfig) $(econfig).new; then               \
+                   rm $(econfig).new;                                  \
+               else                                                    \
+                   echo "Check out $(econfig).new";                    \
+               fi                                                      \
+           else                                                        \
+               echo "Your $(econfig) doesn't work";                    \
+           fi                                                          \
+       else                                                            \
+           src/util/pconfig >$(econfig);                               \
+       fi
+
+.PHONY: installdirs
+installdirs:
+       mkdir -p $(bindir) $(sbindir) $(edatadir) $(einfodir) $(mandir)/man1 $(mandir)/man6 $(dir $(econfig))
+
+.PHONY: install-html
+install-html: html | $(ehtmldir)
+       $(INSTALL_DATA) $(info.html) $(ehtmldir)
 
 .PHONY: uninstall
 uninstall:
 
 .PHONY: uninstall
 uninstall:
@@ -153,10 +192,10 @@ info.html/%.html: info/%.t
 
 ### Explicit rules
 
 
 ### Explicit rules
 
-src/server/emp_server: $(filter src/server/% src/lib/as/% src/lib/commands/% src/lib/player/% src/lib/subs/% src/lib/update/%, $(obj)) $(empth_obj) $(libs) $(empth_lib)
+$(server): $(filter src/server/% src/lib/as/% src/lib/commands/% src/lib/player/% src/lib/subs/% src/lib/update/%, $(obj)) $(empth_obj) $(libs) $(empth_lib)
        $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
 
        $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
 
-src/client/empire: $(filter src/client/%, $(obj)) $(termlibs)
+$(client): $(filter src/client/%, $(obj)) $(termlibs)
        $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
 
 $(util): $(libs)
        $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
 
 $(util): $(libs)
@@ -180,6 +219,7 @@ $(libs) $(empth_lib): | lib
 # multiple targets does what we want.  So we artificially turn the
 # explicit rule into a pattern rule: we replace info with %, and
 # insert a touch target info/stamp.
 # multiple targets does what we want.  So we artificially turn the
 # explicit rule into a pattern rule: we replace info with %, and
 # insert a touch target info/stamp.
+# FIXME if sources.mk is out-of-date, $(tsubj) is, and the bogus deps can prevent remaking of subjects.mk and thus sources.mk
 $(patsubst info/%, \%/%, $(ttop) $(tsubj)): %/stamp
        perl $(srcdir)/info/info.pl
 info/stamp: $(tsrc) info/info.pl sources.mk
 $(patsubst info/%, \%/%, $(ttop) $(tsubj)): %/stamp
        perl $(srcdir)/info/info.pl
 info/stamp: $(tsrc) info/info.pl sources.mk