scc

simple C compiler
git clone git@git.2f30.org/scc.git
Log | Files | Refs | README | LICENSE

Makefile (1151B)


      1 # scc - Suckless C Compiler
      2 .POSIX:
      3 
      4 DIRS  = inc cc1 cc2 driver lib as ar nm objdump
      5 
      6 FORALL = @set -e ;\
      7 	pwd=$$PWD; \
      8 	for i in $(DIRS); \
      9 	do \
     10 		cd $$i; \
     11 		$(MAKE) $@; \
     12 		cd $$pwd; \
     13 	done
     14 
     15 all:
     16 	$(FORALL)
     17 
     18 clean:
     19 	$(FORALL)
     20 	rm -rf rootdir
     21 
     22 distclean:
     23 	touch config.mk    # we need config.mk for makes in $DIRS
     24 	find . -name makefile | xargs rm -f
     25 	$(FORALL)
     26 	rm -rf rootdir
     27 	rm -f config.mk
     28 
     29 config.mk:
     30 	trap "rm -f $$.mk" 0 2 3; \
     31 	(cat config.mk.def ;\
     32 	sed -n '/^# '`uname`'/,/^$$/p' system.mk) > $$.mk && \
     33 	mv $$.mk config.mk
     34 
     35 dep: config.mk
     36 	$(FORALL)
     37 
     38 tests: all
     39 	cd tests && $(MAKE) -e all
     40 
     41 install: all
     42 	cp -r rootdir/* $(DESTDIR)$(PREFIX)/
     43 	cd $(DESTDIR)$(PREFIX)/libexec/scc/ && chmod 755 cc* && strip cc*
     44 	cd $(DESTDIR)$(PREFIX)/bin && chmod 755 scpp scc && strip scc
     45 	mkdir -p $(DESTDIR)$(MANPREFIX)/man1
     46 	sed "s/VERSION/$(VERSION)/g" < doc/scc.1 > $(DESTDIR)$(MANPREFIX)/man1/scc.1
     47 	chmod 644 $(DESTDIR)$(MANPREFIX)/man1/scc.1
     48 
     49 uninstall:
     50 	rm -rf $(DESTDIR)$(PREFIX)/libexec/scc/
     51 	rm -rf $(DESTDIR)$(PREFIX)/lib/scc/
     52 	rm -f $(DESTDIR)$(PREFIX)/bin/scc
     53 	rm -f $(DESTDIR)$(PREFIX)/bin/scpp
     54 	rm -f $(DESTDIR)$(MANPREFIX)/man1/scc.1