shithub: scc

ref: 4506a7ac70b36365f7448c3fe3840550f3230874
dir: /Makefile/

View raw version
# scc - Suckless C Compiler
.POSIX:

include config.mk

SUBDIRS  = lib cc1 cc2
ARCHS   = z80 i386-sysv amd64-sysv

all clean:
	for i in ${SUBDIRS};\
	do \
		(cd $$i; ${MAKE} -$(MAKEFLAGS) $@ || exit); \
	done

multi:
	for i in $(ARCHS) ; \
	do \
		$(MAKE) -$(MAKEFLAGS) $$i || exit ;\
	done

lib/libcc.a:
	cd lib && $(MAKE) -$(MAKEFLAGS) all


$(ARCHS): lib/libcc.a
	for i in cc1 cc2; \
	do \
		(cd $$i; \
		 ARCH=$@ ${MAKE} -e -$(MAKEFLAGS) clean ;\
		 ARCH=$@ $(MAKE) -e $$i || exit); \
	done
	ln -f cc1/cc1 bin/cc1-$@
	ln -f cc2/cc2 bin/cc2-$@

install:
	mkdir -p $(DESTDIR)$(PREFIX)/libexec/scc/
	cp -f bin/cc[12]-*
	cd $(DESTDIR)$(PREFIX)/libexec/scc/ && chmod 755 cc[12]-*


distclean: clean
	rm -f bin/cc[12]-*