libixp

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

hdr.mk (3684B)


      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) $$(pkg-config --cflags $(PACKAGES))
     26 COMPILE    = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(COMPILE_FLAGS)"
     27 COMPILEPIC = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(COMPILE_FLAGS) $(SOCFLAGS)"
     28 
     29 LINK   = $(SHELL) $(ROOT)/util/link "$(LD)" "$$(pkg-config --libs $(PACKAGES)) $(LDFLAGS) $(LIBS)"
     30 LINKSO = $(SHELL) $(ROOT)/util/link "$(LD)" "$$(pkg-config --libs $(PACKAGES)) $(SOLDFLAGS) $(LIBS) $(SHARED)"
     31 
     32 CLEANNAME=$(SHELL) $(ROOT)/util/cleanname
     33 
     34 SOEXT=so
     35 TAGFILES=
     36 
     37 CTAGS=ctags
     38 
     39 PACKAGES = 2>/dev/null
     40 
     41 # and this:
     42 # Try to find a sane shell. /bin/sh is a last resort, because it's
     43 # usually bash on Linux, which means it's painfully slow.
     44 BINSH:= $(shell \
     45 	   if [ -x /bin/dash ]; then echo /bin/dash; \
     46 	   elif [ -x /bin/ksh ]; then echo /bin/ksh; \
     47 	   else echo /bin/sh; fi)
     48 BINSH!= echo /bin/sh
     49 
     50 include $(ROOT)/config.mk
     51 
     52 # I hate this.
     53 MKCFGSH=if test -f $(ROOT)/config.local.mk; then echo $(ROOT)/config.local.mk; else echo /dev/null; fi
     54 MKCFG:=$(shell $(MKCFGSH))
     55 MKCFG!=$(MKCFGSH)
     56 include $(MKCFG)
     57 
     58 .SILENT:
     59 .SUFFIXES: .out .o .o_pic .c .pdf .sh .rc .$(SOEXT) .awk .1 .3 .man1 .man3 .depend .install .uninstall .clean
     60 all:
     61 
     62 MAKEFILES=.depend
     63 .c.depend:
     64 	echo MKDEP $<
     65 	[ -n "$(noisycc)" ] && echo $(MKDEP) $(COMPILE_FLAGS) $< || true
     66 	eval "$(MKDEP) $(COMPILE_FLAGS)" $< | sed '1s|.*:|$(<:%.c=%.o):|' >>.depend
     67 
     68 .sh.depend .rc.depend .1.depend .3.depend .awk.depend:
     69 	:
     70 
     71 .c.o:
     72 	$(COMPILE) $@ $<
     73 .c.o_pic:
     74 	$(COMPILEPIC) $@ $<
     75 
     76 .o.out:
     77 	$(LINK) $@ $<
     78 .c.out:
     79 	$(COMPILE) $(<:.c=.o) $<
     80 	$(LINK) $@ $(<:.c=.o)
     81 
     82 .rc.out .awk.out .sh.out:
     83 	echo FILTER $(BASE)$<
     84 	[ -n "$(<:%.sh=)" ] || $(BINSH) -n $<
     85 	set -e; \
     86 	[ -n "$(noisycc)" ] && set -x; \
     87 	$(FILTER) $< >$@; \
     88 	chmod 0755 $@
     89 
     90 .man1.1 .man3.3:
     91 	echo TXT2TAGS $(BASE)$<
     92 	[ -n "$(noisycc)" ] && set -x; \
     93 	txt2tags -o- $< >$@
     94 
     95 INSTALL= _install() { set -e; \
     96 		 dashb=$$1; [ $$1 = -b ] && shift; \
     97 		 d=$(DESTDIR)$$3; f=$$d/$$(basename $$4); \
     98 		 if [ ! -d $$d ]; then echo MKDIR $$3; mkdir -p $$d; fi; \
     99 		 echo INSTALL $$($(CLEANNAME) $(BASE)$$2); \
    100 		 [ -n "$(noisycc)" ] && set -x; \
    101 		 rm -f $$f; \
    102 		 if [ "$$dashb" = -b ]; \
    103 		 then cp -f $$2 $$f; \
    104 		 else $(FILTER) <$$2 >$$f; \
    105 		 fi; \
    106 		 chmod $$1 $$f; \
    107 		 set +x; \
    108 	 }; _install
    109 UNINSTALL= _uninstall() { set -e; \
    110 	           echo UNINSTALL $$($(CLEANNAME) $(BASE)$$1); \
    111 		   [ -n "$(noisycc)" ] && set -x; \
    112 		   rm -f $(DESTDIR)$$2/$$(basename $$3); \
    113 	   }; _uninstall
    114 
    115 .out.install:
    116 	$(INSTALL) -b 0755 $< $(BIN) $*
    117 .out.uninstall:
    118 	$(UNINSTALL) $< $(BIN) $*
    119 
    120 .a.install .$(SOEXT).install:
    121 	$(INSTALL) -b 0644 $< $(LIBDIR) $<
    122 .a.uninstall .$(SOEXT).uninstall:
    123 	$(UNINSTALL) $< $(LIBDIR) $<
    124 
    125 .h.install:
    126 	$(INSTALL) 0644 $< $(INCLUDE) $<
    127 .h.uninstall:
    128 	$(UNINSTALL) $< $(INCLUDE) $<
    129 
    130 .pdf.install:
    131 	$(INSTALL) -b 0644 $< $(DOC) $<
    132 .pdf.uninstall:
    133 	$(UNINSTALL) $< $(DOC) $<
    134 
    135 INSTALMAN=   _installman()   { man=$${1\#\#*.}; $(INSTALL) 0644 $$1 $(MAN)/man$$man $$1; }; _installman
    136 UNINSTALLMAN=_uninstallman() { man=$${1\#\#*.}; $(UNINSTALL) $$1 $(MAN)/man$$man $$1; }; _uninstallman
    137 MANSECTIONS=1 2 3 4 5 6 7 8 9
    138 $(MANSECTIONS:%=.%.install):
    139 	$(INSTALMAN) $<
    140 $(MANSECTIONS:%=.%.uninstall):
    141 	$(UNINSTALLMAN) $<
    142 
    143 .out.clean:
    144 	echo CLEAN $$($(CLEANNAME) $(BASE)$<)
    145 	rm -f $< || true 2>/dev/null
    146 	rm -f $*.o || true 2>/dev/null
    147 .o.clean .o_pic.clean:
    148 	echo CLEAN $$($(CLEANNAME) $(BASE)$<)
    149 	rm -f $< || true 2>/dev/null
    150 
    151 printinstall:
    152 clean:
    153 install: printinstall
    154 depend: cleandep
    155 
    156 include $(ROOT)/mk/common.mk
    157