prog.mk (2369B)
1 include $(TOPDIR)/mk/phony.mk 2 3 CLEAN = $(OBJS) $(BINS:=.o) $(BINS) $(MANS) $(PAGES) compile_flags.txt 4 5 all: binaries pages manuals compile_flags.txt 6 7 binaries: $(BINS) 8 9 manuals: $(MANS) 10 11 pages: $(PAGES) 12 13 clean: 14 @echo "[ RM ] $(CLEAN)" 15 $(SILENT)-rm -f $(CLEAN) 16 @for lib in $(LIBS); do \ 17 make -C `dirname $$lib` clean; \ 18 done 19 20 install: install-binaries install-manuals install-pages 21 22 install-binaries: binaries 23 $(SILENT)install -d $(PREFIX)/bin 24 $(SILENT)for file in $(BINS); do \ 25 echo "[INST] $(PREFIX)/bin/$$file"; \ 26 install -m 755 $$file $(PREFIX)/bin; \ 27 done 28 29 install-manuals: manuals 30 $(SILENT)for file in $(MANS); do \ 31 filename=$$(basename "$$file"); \ 32 section="$${filename##*.}"; \ 33 install -d $(PREFIX)/share/man/man$$section; \ 34 echo "[INST] $(PREFIX)/share/man/man$$section/$$file"; \ 35 install -m 755 $$file $(PREFIX)/share/man/man$$section/; \ 36 done 37 38 install-pages: pages 39 $(SILENT)install -d $(PREFIX)/share/doc/fiss; 40 $(SILENT)for file in $(PAGES); do \ 41 echo "[INST] $(PREFIX)/share/doc/fiss/$$file"; \ 42 install -m 755 $$file $(PREFIX)/share/doc/fiss/; \ 43 done 44 45 uninstall: uninstall-binaries uninstall-manuals uninstall-pages 46 47 uninstall-binaries: 48 $(SILENT)for file in $(BINS); do \ 49 echo "[ RM ] $(PREFIX)/bin/$$file"; \ 50 rm -f $(PREFIX)/bin/$$file; \ 51 done 52 53 uninstall-manuals: 54 $(SILENT)for file in $(MANS); do \ 55 filename=$$(basename "$$file"); \ 56 section="$${filename##*.}"; \ 57 echo "[ RM ] $(PREFIX)/share/man/man$$section/$$file"; \ 58 rm -f $(PREFIX)/share/man/man$$section/$$file; \ 59 done 60 61 uninstall-pages: 62 @echo "[ RM ] $(PREFIX)/share/doc/fiss"; 63 $(SILENT)rm -fr $(PREFIX)/share/doc/fiss; 64 65 .PRECIOUS: $(BINS:=.o) 66 67 include $(TOPDIR)/mk/object.mk 68 69 # Executables 70 %: %.o $(OBJS) $(LIBS) 71 @echo "[ LD ] $@" 72 $(SILENT)$(CC) -o $@ $^ $(LDFLAGS) 73 74 # Shell Executables 75 %: %.sh 76 @echo "[COPY] $< -> $@" 77 $(SILENT)cp $< $@ 78 $(SILENT)chmod +x $@ 79 80 # Symbolic Links 81 %: %.lnk 82 @echo "[LINK] $< -> $@" 83 $(SILENT)ln -sf $(shell cat $<) $@ 84 85 # Documentation 86 %.html: %.txt 87 @echo "[MDOC] $< -> $@" 88 $(SILENT)$(SED) $(IN_REPLACE) $< | $(PYTHON) $(TOPDIR)/tools/make-docs.py $(TOPDIR)/assets/template.html > $@ 89 90 # Manual 91 %: %.txt 92 @echo "[MMAN] $< -> $@" 93 $(SILENT)$(SED) $(IN_REPLACE) $< | $(PYTHON) $(TOPDIR)/tools/make-man.py | $(AWK) '/./ { print }' > $@ 94 95 # Libraries 96 $(LIBDIR)/%: 97 make -C $(dir $@) $(notdir $@)