wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

hdr.mk (3510B)


      1 DIR =
      2 DIRS =
      3 DOC =
      4 DOCDIR =
      5 DOCS =
      6 EXECS =
      7 HFILES =
      8 INCLUDES =
      9 LIB =
     10 LIBS =
     11 OBJ =
     12 OFILES =
     13 OFILES_PIC =
     14 PACKAGES =
     15 PROG =
     16 SO =
     17 TAGFILES =
     18 TARG =
     19 TEXT =
     20 
     21 FILTER = cat
     22 
     23 EXCFLAGS = $(INCLUDES) -D_XOPEN_SOURCE=600
     24 
     25 COMPILE_FLAGS = $(EXCFLAGS) $(CFLAGS)
     26 COMPILE    = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(PACKAGES)" "$(COMPILE_FLAGS)"
     27 COMPILEPIC = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(PACKAGES)" "$(COMPILE_FLAGS) $(SOCFLAGS)"
     28 
     29 LINK   = $(SHELL) $(ROOT)/util/link "$(LD)" "$(PACKAGES)" "$(LDFLAGS) $(LIBS)"
     30 LINKSO = $(SHELL) $(ROOT)/util/link "$(LD)" "$(PACKAGES)" "$(SOLDFLAGS) $(LIBS) $(SHARED)"
     31 
     32 CLEANNAME=$(SHELL) $(ROOT)/util/cleanname
     33 
     34 SOEXT=so
     35 TAGFILES=
     36 
     37 CTAGS=ctags --fields=+S --c-kinds=+px
     38 
     39 PACKAGES = 
     40 
     41 # Try to find a sane shell. /bin/sh is a last resort, because it's
     42 # usually bash on Linux, which means it's painfully slow.
     43 SHELLSEARCH = for sh in /bin/dash /bin/ksh /bin/sh; do \
     44 	      if test -x $$sh; then echo $$sh; exit; fi; done
     45 
     46 BINSH:= $(shell $(SHELLSEARCH))
     47 BINSH!= $(SHELLSEARCH)
     48 SHELL := $(BINSH)
     49 .SHELL: name=sh path=$(SHELL)
     50 
     51 include $(ROOT)/config.mk
     52 sinclude $(ROOT)/config.local.mk
     53 sinclude $(shell echo .)depend
     54 
     55 .SILENT:
     56 .SUFFIXES: .$(SOEXT) .1 .3 .awk .build .c .clean .depend .install .man1 .man3 .o .o_pic .out .pdf .py .rc .sh .uninstall
     57 all:
     58 
     59 .c.depend:
     60 	echo MKDEP $<
     61 	$(DEBUG) eval "$(MKDEP) $(COMPILE_FLAGS)" $< | sed '1s|.*:|$(<:%.c=%.o):|' >>.depend
     62 
     63 .sh.depend .rc.depend .1.depend .3.depend .awk.depend:
     64 	:
     65 
     66 .c.o:
     67 	$(COMPILE) $@ $<
     68 .c.o_pic:
     69 	$(COMPILEPIC) $@ $<
     70 
     71 .o.out:
     72 	$(LINK) $@ $<
     73 .c.out:
     74 	$(COMPILE) $(<:.c=.o) $<
     75 	$(LINK) $@ $(<:.c=.o)
     76 
     77 .rc.out .awk.out .sh.out:
     78 	echo FILTER $(BASE)$<
     79 	[ -n "$(<:%.sh=)" ] || $(BINSH) -n $<
     80 	set -e; \
     81 	$(DEBUG) $(FILTER) $< >$@; \
     82 	$(DEBUG) chmod 0755 $@
     83 
     84 .man1.1 .man3.3:
     85 	echo TXT2TAGS $(BASE)$<
     86 	$(DEBUG) txt2tags -o- $< >$@
     87 
     88 DEBUG = _debug() { [ -n "$$noisycc" ] && echo >&2 $$@ || true; "$$@"; }; _debug
     89 
     90 INSTALL= _install() { set -e; \
     91 		 dashb=$$1; [ $$1 = -b ] && shift; \
     92 		 d=$(DESTDIR)$$3; f=$$d/$$(basename $$4); \
     93 		 if [ ! -d $$d ]; then echo MKDIR $$3; mkdir -p $$d; fi; \
     94 		 echo INSTALL $$($(CLEANNAME) $(BASE)$$2); \
     95 		 $(DEBUG) rm -f $$f; \
     96 		 if [ "$$dashb" = -b ]; \
     97 		 then $(DEBUG) cp -f $$2 $$f; \
     98 		 else $(DEBUG) $(FILTER) <$$2 >$$f; \
     99 		 fi; \
    100 		 $(DEBUG) chmod $$1 $$f; \
    101 	 }; _install
    102 UNINSTALL= _uninstall() { set -e; \
    103 	           echo UNINSTALL $$($(CLEANNAME) $(BASE)$$1); \
    104 		   $(DEBUG) rm -f $(DESTDIR)$$2/$$(basename $$3); \
    105 	   }; _uninstall
    106 
    107 .out.install:
    108 	$(INSTALL) -b 0755 $< $(BIN) $*
    109 .out.uninstall:
    110 	$(UNINSTALL) $< $(BIN) $*
    111 
    112 .a.install .$(SOEXT).install:
    113 	$(INSTALL) -b 0644 $< $(LIBDIR) $<
    114 .a.uninstall .$(SOEXT).uninstall:
    115 	$(UNINSTALL) $< $(LIBDIR) $<
    116 
    117 .h.install:
    118 	$(INSTALL) 0644 $< $(INCLUDE) $<
    119 .h.uninstall:
    120 	$(UNINSTALL) $< $(INCLUDE) $<
    121 
    122 .pdf.install:
    123 	$(INSTALL) -b 0644 $< $(DOC) $<
    124 .pdf.uninstall:
    125 	$(UNINSTALL) $< $(DOC) $<
    126 
    127 INSTALMAN=   _installman()   { man=$${1\#\#*.}; $(INSTALL) 0644 $$1 $(MAN)/man$$man $$1; }; _installman
    128 UNINSTALLMAN=_uninstallman() { man=$${1\#\#*.}; $(UNINSTALL) $$1 $(MAN)/man$$man $$1; }; _uninstallman
    129 MANSECTIONS=1 2 3 4 5 6 7 8 9
    130 $(MANSECTIONS:%=.%.install):
    131 	$(INSTALMAN) $<
    132 $(MANSECTIONS:%=.%.uninstall):
    133 	$(UNINSTALLMAN) $<
    134 
    135 .out.clean:
    136 	echo CLEAN $$($(CLEANNAME) $(BASE)$<)
    137 	rm -f $< || true 2>/dev/null
    138 	rm -f $*.o || true 2>/dev/null
    139 .o.clean .o_pic.clean:
    140 	echo CLEAN $$($(CLEANNAME) $(BASE)$<)
    141 	rm -f $< || true 2>/dev/null
    142 
    143 printinstall:
    144 clean:
    145 install: printinstall
    146 depend: cleandep
    147 
    148 include $(ROOT)/mk/common.mk
    149