X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/micropolis/blobdiff_plain/7709f34cf5785350db2d99f196afcbcf6122b4aa..81583a602d526bf267d2426f84615e512567b29a:/Makefile diff --git a/Makefile b/Makefile index a7bc2dc..dc804a4 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,17 @@ PREFIX=/usr/local DATADIR=$(PREFIX)/share/micropolis -LIBEXECDIR=$(PREFIX)/libexec +LIBEXECDIR=$(PREFIX)/libexec/micropolis BINDIR=$(PREFIX)/bin DOCDIR=$(PREFIX)/share/doc/micropolis +PIXMAPDIR=$(PREFIX)/share/pixmaps +APPLICATIONSDIR=$(PREFIX)/share/applications INSTALL=install -DIRS= $(DATADIR)/res/sounds $(DATADIR)/res/dejavu-lgc $(DATADIR)/images \ - $(DATADIR)/cities $(LIBEXECDIR) $(BINDIR) $(DOCDIR) +DIRS= $(DESTDIR)/$(DATADIR)/res/sounds $(DESTDIR)/$(DATADIR)/res/dejavu-lgc \ + $(DESTDIR)/$(DATADIR)/images $(DESTDIR)/$(DATADIR)/cities \ + $(DESTDIR)/$(LIBEXECDIR) $(DESTDIR)/$(BINDIR) $(DESTDIR)/$(DOCDIR) \ + $(DESTDIR)/$(PIXMAPDIR) $(DESTDIR)/$(APPLICATIONSDIR) RES= res/buildidx.tcl res/button.tcl res/entry.tcl res/help.tcl res/hexa.112 \ res/hexa.232 res/hexa.384 res/hexa.385 res/hexa.386 res/hexa.387 \ @@ -51,39 +55,71 @@ clean: cd src/tclx && $(MAKE) MAKEFLAGS= $@ rm -f res/sim -install: res/sim install-dirs install-bin install-res install-images install-cities install-doc +install: res/sim install-dirs install-bin install-res install-images \ + install-cities install-doc install-desktop install-dirs: $(INSTALL) -d $(DIRS) install-bin: - $(INSTALL) -m 0755 res/sim $(LIBEXECDIR)/sim - $(INSTALL) -m 0755 res/sounds/player $(DATADIR)/res/sounds/player - echo "SIMHOME=$(DATADIR); export SIMHOME" >$(PREFIX)/bin/Micropolis - echo "echo \"Starting Micropolis in \$${SIMHOME} ... \"" >>$(PREFIX)/bin/Micropolis - echo "cd $(DATADIR) && $(LIBEXECDIR)/sim \$$*" >>$(PREFIX)/bin/Micropolis - chmod 755 $(PREFIX)/bin/Micropolis + $(INSTALL) -m 0755 res/sim $(DESTDIR)/$(LIBEXECDIR)/sim + $(INSTALL) -m 0755 res/sounds/player $(DESTDIR)/$(DATADIR)/res/sounds/player + echo "#!/bin/sh" >$(DESTDIR)/$(BINDIR)/micropolis + echo "SIMHOME=$(DATADIR); export SIMHOME" >>$(DESTDIR)/$(BINDIR)/micropolis + echo "echo \"Starting Micropolis in \$${SIMHOME} ... \"" >>$(DESTDIR)/$(BINDIR)/micropolis + echo "cd $(DATADIR) && exec $(LIBEXECDIR)/sim \"\$$@\"" >>$(DESTDIR)/$(BINDIR)/micropolis + chmod 755 $(DESTDIR)/$(BINDIR)/micropolis install-res: install-res-sounds install-res-dejavu-lgc for file in $(RES); do \ - install -m 0644 $$file $(DATADIR)/$$file; \ + install -m 0644 $$file $(DESTDIR)/$(DATADIR)/$$file; \ done install-res-sounds: - find res/sounds -type f -name \*.wav -exec $(INSTALL) -m 0644 {} $(DATADIR)/res/sounds/ \; + find res/sounds -type f -name \*.wav -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DATADIR)/res/sounds/ \; install-res-dejavu-lgc: - find res/dejavu-lgc -type f -exec $(INSTALL) -m 0644 {} $(DATADIR)/res/dejavu-lgc/ \; + find res/dejavu-lgc -type f -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/ \; install-images: - find images -type f -exec $(INSTALL) -m 0644 {} $(DATADIR)/images/ \; + find images -type f -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DATADIR)/images/ \; install-cities: - find cities -type f -exec $(INSTALL) -m 0644 {} $(DATADIR)/cities/ \; + find cities -type f -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DATADIR)/cities/ \; install-doc: - find manual -type f -exec $(INSTALL) -m 0644 {} $(DOCDIR)/ \; + find manual -type f -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DOCDIR)/ \; + +install-desktop: + $(INSTALL) -m 0644 Micropolis.desktop $(DESTDIR)/$(APPLICATIONSDIR)/micropolis.desktop + $(INSTALL) -m 0644 Micropolis.png $(DESTDIR)/$(PIXMAPDIR)/micropolis.png + +uninstall: + rm -f $(DESTDIR)/$(BINDIR)/micropolis + rm -f $(DESTDIR)/$(LIBEXECDIR)/sim + -rmdir $(DESTDIR)/$(LIBEXECDIR) + rm -f $(DESTDIR)/$(DATADIR)/res/sounds/player + rm -f $(DESTDIR)/$(DATADIR)/res/sounds/*.wav + -rmdir $(DESTDIR)/$(DATADIR)/res/sounds + rm -f $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/*ttf \ + $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/fonts.alias \ + $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/fonts.dir \ + $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/fonts.scale + -rmdir $(DESTDIR)/$(DATADIR)/res/dejavu-lgc + for file in $(RES); do \ + rm $(DESTDIR)/$(DATADIR)/$$file; \ + done + -rmdir $(DESTDIR)/$(DATADIR)/res + rm -f $(DESTDIR)/$(DATADIR)/images/*.xpm + -rmdir $(DESTDIR)/$(DATADIR)/images + rm -f $(DESTDIR)/$(DATADIR)/cities/*.cty + -rmdir $(DESTDIR)/$(DATADIR)/cities + -rmdir $(DESTDIR)/$(DATADIR) + rm -f $(DESTDIR)/$(DOCDIR)/*.html $(DESTDIR)/$(DOCDIR)/README + -rmdir $(DESTDIR)/$(DOCDIR) + rm -f $(DESTDIR)/$(APPLICATIONSDIR)/micropolis.desktop + rm -f $(DESTDIR)/$(PIXMAPDIR)/micropolis.png .PHONY: all clean install install-dirs install-bin install-res \ install-res-sounds install-res-dejavu-lgc install-images \ - install-cities install-doc tcl tk tclx sim + install-cities install-doc install-desktop uninstall tcl tk tclx sim