| 1 | PREFIX=/usr/local |
| 2 | DATADIR=$(PREFIX)/share/micropolis |
| 3 | LIBEXECDIR=$(PREFIX)/libexec |
| 4 | BINDIR=$(PREFIX)/bin |
| 5 | DOCDIR=$(PREFIX)/share/doc/micropolis |
| 6 | PIXMAPDIR=$(PREFIX)/share/pixmaps |
| 7 | APPLICATIONSDIR=$(PREFIX)/share/applications |
| 8 | |
| 9 | INSTALL=install |
| 10 | |
| 11 | DIRS= $(DESTDIR)/$(DATADIR)/res/sounds $(DESTDIR)/$(DATADIR)/res/dejavu-lgc \ |
| 12 | $(DESTDIR)/$(DATADIR)/images $(DESTDIR)/$(DATADIR)/cities \ |
| 13 | $(DESTDIR)/$(LIBEXECDIR) $(DESTDIR)/$(BINDIR) $(DESTDIR)/$(DOCDIR) \ |
| 14 | $(DESTDIR)/$(PIXMAPDIR) $(DESTDIR)/$(APPLICATIONSDIR) |
| 15 | |
| 16 | RES= res/buildidx.tcl res/button.tcl res/entry.tcl res/help.tcl res/hexa.112 \ |
| 17 | res/hexa.232 res/hexa.384 res/hexa.385 res/hexa.386 res/hexa.387 \ |
| 18 | res/hexa.388 res/hexa.456 res/hexa.544 res/hexa.563 res/hexa.999 \ |
| 19 | res/init.tcl res/listbox.tcl res/menu.tcl res/micropolis.tcl \ |
| 20 | res/mkindex.tcl res/parray.tcl res/snro.111 res/snro.222 res/snro.333 \ |
| 21 | res/snro.444 res/snro.555 res/snro.666 res/snro.777 res/snro.888 \ |
| 22 | res/sound.tcl res/stri.202 res/stri.219 res/stri.301 res/stri.356 \ |
| 23 | res/tcl.tdx res/tcl.tlb res/tclindex res/tclinit.tcl res/text.tcl \ |
| 24 | res/tk.tcl res/tk.tdx res/tk.tlb res/tkerror.tcl res/wask.tcl \ |
| 25 | res/wbudget.tcl res/weditor.tcl res/weval.tcl res/wfile.tcl \ |
| 26 | res/wfrob.tcl res/wgraph.tcl res/whead.tcl res/whelp.tcl res/wish.tcl \ |
| 27 | res/wishx.tcl res/wmap.tcl res/wnotice.tcl res/wplayer.tcl \ |
| 28 | res/wscen.tcl res/wsplash.tcl |
| 29 | |
| 30 | all: res/sim |
| 31 | |
| 32 | res/sim: src/sim/sim |
| 33 | cp src/sim/sim $@ |
| 34 | strip $@ |
| 35 | |
| 36 | src/sim/sim: tcl tk tclx sim |
| 37 | @# |
| 38 | |
| 39 | tcl: |
| 40 | cd src/tcl && $(MAKE) MAKEFLAGS= |
| 41 | |
| 42 | tk: |
| 43 | cd src/tk && $(MAKE) MAKEFLAGS= |
| 44 | |
| 45 | tclx: |
| 46 | cd src/tclx && $(MAKE) MAKEFLAGS= |
| 47 | |
| 48 | sim: |
| 49 | cd src/sim && $(MAKE) MAKEFLAGS= |
| 50 | |
| 51 | clean: |
| 52 | cd src/sim && $(MAKE) MAKEFLAGS= $@ |
| 53 | cd src/tcl && $(MAKE) MAKEFLAGS= $@ |
| 54 | cd src/tk && $(MAKE) MAKEFLAGS= $@ |
| 55 | cd src/tclx && $(MAKE) MAKEFLAGS= $@ |
| 56 | rm -f res/sim |
| 57 | |
| 58 | install: res/sim install-dirs install-bin install-res install-images \ |
| 59 | install-cities install-doc install-desktop |
| 60 | |
| 61 | install-dirs: |
| 62 | $(INSTALL) -d $(DIRS) |
| 63 | |
| 64 | install-bin: |
| 65 | $(INSTALL) -m 0755 res/sim $(DESTDIR)/$(LIBEXECDIR)/sim |
| 66 | $(INSTALL) -m 0755 res/sounds/player $(DESTDIR)/$(DATADIR)/res/sounds/player |
| 67 | echo "SIMHOME=$(DATADIR); export SIMHOME" >$(DESTDIR)/$(BINDIR)/micropolis |
| 68 | echo "echo \"Starting Micropolis in \$${SIMHOME} ... \"" >>$(DESTDIR)/$(BINDIR)/micropolis |
| 69 | echo "cd $(DATADIR) && $(LIBEXECDIR)/sim \$$*" >>$(DESTDIR)/$(BINDIR)/micropolis |
| 70 | chmod 755 $(DESTDIR)/$(BINDIR)/micropolis |
| 71 | |
| 72 | install-res: install-res-sounds install-res-dejavu-lgc |
| 73 | for file in $(RES); do \ |
| 74 | install -m 0644 $$file $(DESTDIR)/$(DATADIR)/$$file; \ |
| 75 | done |
| 76 | |
| 77 | install-res-sounds: |
| 78 | find res/sounds -type f -name \*.wav -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DATADIR)/res/sounds/ \; |
| 79 | |
| 80 | install-res-dejavu-lgc: |
| 81 | find res/dejavu-lgc -type f -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/ \; |
| 82 | |
| 83 | install-images: |
| 84 | find images -type f -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DATADIR)/images/ \; |
| 85 | |
| 86 | install-cities: |
| 87 | find cities -type f -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DATADIR)/cities/ \; |
| 88 | |
| 89 | install-doc: |
| 90 | find manual -type f -exec $(INSTALL) -m 0644 {} $(DESTDIR)/$(DOCDIR)/ \; |
| 91 | |
| 92 | install-desktop: |
| 93 | $(INSTALL) -m 0644 Micropolis.desktop $(DESTDIR)/$(APPLICATIONSDIR)/micropolis.desktop |
| 94 | $(INSTALL) -m 0644 Micropolis.png $(DESTDIR)/$(PIXMAPDIR)/micropolis.png |
| 95 | |
| 96 | uninstall: |
| 97 | rm -f $(DESTDIR)/$(BINDIR)/micropolis |
| 98 | rm -f $(DESTDIR)/$(LIBEXECDIR)/sim |
| 99 | -rmdir $(DESTDIR)/$(LIBEXECDIR) |
| 100 | rm -f $(DESTDIR)/$(DATADIR)/res/sounds/player |
| 101 | rm -f $(DESTDIR)/$(DATADIR)/res/sounds/*.wav |
| 102 | -rmdir $(DESTDIR)/$(DATADIR)/res/sounds |
| 103 | rm -f $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/*ttf \ |
| 104 | $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/fonts.alias \ |
| 105 | $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/fonts.dir \ |
| 106 | $(DESTDIR)/$(DATADIR)/res/dejavu-lgc/fonts.scale |
| 107 | -rmdir $(DESTDIR)/$(DATADIR)/res/dejavu-lgc |
| 108 | for file in $(RES); do \ |
| 109 | rm $(DESTDIR)/$(DATADIR)/$$file; \ |
| 110 | done |
| 111 | -rmdir $(DESTDIR)/$(DATADIR)/res |
| 112 | rm -f $(DESTDIR)/$(DATADIR)/images/*.xpm |
| 113 | -rmdir $(DESTDIR)/$(DATADIR)/images |
| 114 | rm -f $(DESTDIR)/$(DATADIR)/cities/*.cty |
| 115 | -rmdir $(DESTDIR)/$(DATADIR)/cities |
| 116 | -rmdir $(DESTDIR)/$(DATADIR) |
| 117 | rm -f $(DESTDIR)/$(DOCDIR)/*.html $(DESTDIR)/$(DOCDIR)/README |
| 118 | -rmdir $(DESTDIR)/$(DOCDIR) |
| 119 | rm -f $(DESTDIR)/$(APPLICATIONSDIR)/micropolis.desktop |
| 120 | rm -f $(DESTDIR)/$(PIXMAPDIR)/micropolis.png |
| 121 | |
| 122 | .PHONY: all clean install install-dirs install-bin install-res \ |
| 123 | install-res-sounds install-res-dejavu-lgc install-images \ |
| 124 | install-cities install-doc install-desktop uninstall tcl tk tclx sim |