sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

Makefile (4138B)


      1 .POSIX:
      2 include config.mk
      3 
      4 .SUFFIXES:
      5 .SUFFIXES: .y .o .c
      6 
      7 CPPFLAGS =\
      8 	-DPREFIX=\"$(PREFIX)\" \
      9 	-D_DEFAULT_SOURCE \
     10 	-D_NETBSD_SOURCE \
     11 	-D_BSD_SOURCE \
     12 	-D_XOPEN_SOURCE=700 \
     13 	-D_FILE_OFFSET_BITS=64
     14 
     15 HDR =\
     16 	arg.h\
     17 	compat.h\
     18 	crypt.h\
     19 	fs.h\
     20 	md5.h\
     21 	queue.h\
     22 	sha1.h\
     23 	sha224.h\
     24 	sha256.h\
     25 	sha384.h\
     26 	sha512.h\
     27 	sha512-224.h\
     28 	sha512-256.h\
     29 	text.h\
     30 	utf.h\
     31 	util.h
     32 
     33 LIBUTFOBJ =\
     34 	libutf/fgetrune.o\
     35 	libutf/fputrune.o\
     36 	libutf/isalnumrune.o\
     37 	libutf/isalpharune.o\
     38 	libutf/isblankrune.o\
     39 	libutf/iscntrlrune.o\
     40 	libutf/isdigitrune.o\
     41 	libutf/isgraphrune.o\
     42 	libutf/isprintrune.o\
     43 	libutf/ispunctrune.o\
     44 	libutf/isspacerune.o\
     45 	libutf/istitlerune.o\
     46 	libutf/isxdigitrune.o\
     47 	libutf/lowerrune.o\
     48 	libutf/rune.o\
     49 	libutf/runetype.o\
     50 	libutf/upperrune.o\
     51 	libutf/utf.o\
     52 	libutf/utftorunestr.o
     53 
     54 LIBUTILOBJ =\
     55 	libutil/concat.o\
     56 	libutil/cp.o\
     57 	libutil/crypt.o\
     58 	libutil/confirm.o\
     59 	libutil/ealloc.o\
     60 	libutil/enmasse.o\
     61 	libutil/eprintf.o\
     62 	libutil/eregcomp.o\
     63 	libutil/estrtod.o\
     64 	libutil/fnck.o\
     65 	libutil/fshut.o\
     66 	libutil/getlines.o\
     67 	libutil/human.o\
     68 	libutil/linecmp.o\
     69 	libutil/md5.o\
     70 	libutil/memmem.o\
     71 	libutil/mkdirp.o\
     72 	libutil/mode.o\
     73 	libutil/parseoffset.o\
     74 	libutil/putword.o\
     75 	libutil/reallocarray.o\
     76 	libutil/recurse.o\
     77 	libutil/rm.o\
     78 	libutil/sha1.o\
     79 	libutil/sha224.o\
     80 	libutil/sha256.o\
     81 	libutil/sha384.o\
     82 	libutil/sha512.o\
     83 	libutil/sha512-224.o\
     84 	libutil/sha512-256.o\
     85 	libutil/strcasestr.o\
     86 	libutil/strlcat.o\
     87 	libutil/strlcpy.o\
     88 	libutil/strsep.o\
     89 	libutil/strnsubst.o\
     90 	libutil/strtonum.o\
     91 	libutil/unescape.o\
     92 	libutil/writeall.o
     93 
     94 LIB = libutf.a libutil.a
     95 
     96 BIN =\
     97 	basename\
     98 	bc\
     99 	cal\
    100 	cat\
    101 	chgrp\
    102 	chmod\
    103 	chown\
    104 	chroot\
    105 	cksum\
    106 	cmp\
    107 	cols\
    108 	comm\
    109 	cp\
    110 	cron\
    111 	cut\
    112 	date\
    113 	dc\
    114 	dd\
    115 	dirname\
    116 	du\
    117 	echo\
    118 	ed\
    119 	env\
    120 	expand\
    121 	expr\
    122 	false\
    123 	find\
    124 	flock\
    125 	fold\
    126 	getconf\
    127 	grep\
    128 	head\
    129 	hostname\
    130 	join\
    131 	kill\
    132 	link\
    133 	ln\
    134 	logger\
    135 	logname\
    136 	ls\
    137 	make/make\
    138 	md5sum\
    139 	mkdir\
    140 	mkfifo\
    141 	mknod\
    142 	mktemp\
    143 	mv\
    144 	nice\
    145 	nl\
    146 	nohup\
    147 	od\
    148 	paste\
    149 	pathchk\
    150 	printenv\
    151 	printf\
    152 	pwd\
    153 	readlink\
    154 	renice\
    155 	rev\
    156 	rm\
    157 	rmdir\
    158 	sed\
    159 	seq\
    160 	setsid\
    161 	sha1sum\
    162 	sha224sum\
    163 	sha256sum\
    164 	sha384sum\
    165 	sha512sum\
    166 	sha512-224sum\
    167 	sha512-256sum\
    168 	sleep\
    169 	sort\
    170 	split\
    171 	sponge\
    172 	strings\
    173 	sync\
    174 	tail\
    175 	tar\
    176 	tee\
    177 	test\
    178 	tftp\
    179 	time\
    180 	touch\
    181 	tr\
    182 	true\
    183 	tsort\
    184 	tty\
    185 	uname\
    186 	unexpand\
    187 	uniq\
    188 	unlink\
    189 	uudecode\
    190 	uuencode\
    191 	wc\
    192 	which\
    193 	whoami\
    194 	xargs\
    195 	xinstall\
    196 	yes
    197 
    198 MAKEOBJ =\
    199 	make/defaults.o\
    200 	make/main.o\
    201 	make/parser.o\
    202 	make/posix.o\
    203 	make/rules.o\
    204 
    205 OBJ = $(LIBUTFOBJ) $(LIBUTILOBJ) $(MAKEOBJ)
    206 
    207 all: scripts/make
    208 	+@$(SMAKE) $(BIN)
    209 
    210 scripts/make:
    211 	$(CC) -o $@ make/*.c
    212 
    213 $(BIN): $(LIB)
    214 
    215 $(OBJ) $(BIN): $(HDR)
    216 
    217 .o:
    218 	$(CC) $(LDFLAGS) -o $@ $< $(LIB)
    219 
    220 .c.o:
    221 	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
    222 
    223 .c:
    224 	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIB)
    225 
    226 bc: bc.c
    227 	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ bc.c $(LIB)
    228 
    229 $(MAKEOBJ): make/make.h
    230 
    231 make/make: $(MAKEOBJ)
    232 	$(CC) $(LDFLAGS) -o $@ $(MAKEOBJ) $(LIB)
    233 
    234 libutf.a: $(LIBUTFOBJ)
    235 	$(AR) $(ARFLAGS) $@ $?
    236 	$(RANLIB) $@
    237 
    238 libutil.a: $(LIBUTILOBJ)
    239 	$(AR) $(ARFLAGS) $@ $?
    240 	$(RANLIB) $@
    241 
    242 getconf: getconf.h
    243 
    244 getconf.h:
    245 	scripts/getconf.sh > $@
    246 
    247 proto: $(BIN)
    248 	scripts/mkproto $(DESTDIR)$(PREFIX) $(DESTDIR)$(MANPREFIX) proto
    249 
    250 install uninstall: proto
    251 	scripts/$@ proto
    252 
    253 sbase-box-install: sbase-box proto
    254 	scripts/install proto
    255 	$(DESTDIR)$(PREFIX)/bin/sbase-box -i $(DESTDIR)$(PREFIX)/bin/
    256 
    257 sbase-box-uninstall: sbase-box proto
    258 	$(DESTDIR)$(PREFIX)/bin/sbase-box -d $(DESTDIR)$(PREFIX)/bin/
    259 	scripts/uninstall proto
    260 
    261 tests: all
    262 	@cd $@ && $(MAKE)
    263 
    264 dist: clean
    265 	mkdir -p sbase
    266 	cp LICENSE Makefile README TODO config.mk *.c *.1 *.h  sbase
    267 	cp -R libutf libutil make scripts tests sbase
    268 	mv sbase sbase-$(VERSION)
    269 	tar -cf sbase-$(VERSION).tar sbase-$(VERSION)
    270 	gzip sbase-$(VERSION).tar
    271 	rm -rf sbase-$(VERSION)
    272 
    273 sbase-box: $(BIN)
    274 	scripts/mkbox
    275 	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ build/*.c $(LIB)
    276 
    277 clean:
    278 	@cd tests && $(MAKE) clean
    279 	rm -f *.o
    280 	rm -f $(BIN) $(LIB) sbase-box sbase-$(VERSION).tar.gz
    281 	rm -f scripts/make
    282 	rm -f getconf.h bc.c
    283 	rm -f proto
    284 	rm -rf build
    285 
    286 .PHONY: all install uninstall dist sbase-box-install sbase-box-uninstall clean