shithub: scc

ref: 02abca68e91999009c0f3ef154fb99f39c212c2c
dir: /Makefile/

View raw version
.POSIX:

PROJECTDIR = .
include $(PROJECTDIR)/scripts/rules.mk

DIRS  = src include/scc/scc tests
ENV   = $(SCRIPTDIR)/env.sh

all: src

src: dirs include/scc/scc

dirs: $(SCRIPTDIR)/libc-proto
	xargs mkdir -p < $(SCRIPTDIR)/libc-proto
	touch dirs

$(DIRS): $(ENV) FORCE
	+@. $(ENV) && cd $@ && $(MAKE)

$(ENV):
	@rm -f $@; \
	trap 'r=$?;rm -f $$$$.tmp;exit $r' EXIT HUP INT QUIT TERM; \
	echo PATH=$$PATH:$$PWD/$(SCRIPTDIR):. > $$$$.tmp && \
	echo NM=\"$(NM)\" >> $$$$.tmp && \
	echo AR=\"$(AR)\" >> $$$$.tmp && \
	echo RL=\"$(RL)\" >> $$$$.tmp && \
	echo RLFLAGS=\"$(RLFLAGS)\" >> $$$$.tmp && \
	echo export PATH RLFLAGS NM AR RL >> $$$$.tmp && \
	mv $$$$.tmp $@

dep:
	$(FORALL)

clean:
	$(FORALL)
	rm -rf lib bin libexec dirs $(ENV)

distclean: clean
	+@cd include/scc/scc && $(MAKE) distclean

tests: all