scc

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

commit 4f96e73cfc1e0f86ffd557d377f7489999a8a31e
parent b66f292f0ae3c4800eea3e1986cfd92796a129ea
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 24 Jan 2016 17:31:18 +0100

Rewrite the Makefile again

Some of the previous rules were generating some problems
(for example once the library was built everything was
updated with it).

Diffstat:
MMakefile | 47++++++++++++++++++++++++-----------------------
1 file changed, 24 insertions(+), 23 deletions(-)

diff --git a/Makefile b/Makefile @@ -3,29 +3,25 @@ include config.mk -SUBDIRS = lib cc1 cc2 driver/$(DRIVER) -ARCHS = z80 i386-sysv amd64-sysv +DIRS = lib cc1 cc2 driver/$(DRIVER) +ARCHS = z80 i386-sysv amd64-sysv -all clean: - for i in ${SUBDIRS};\ - do \ - (cd $$i; ${MAKE} -$(MAKEFLAGS) $@ || exit); \ +all: + for i in $(DIRS) ; \ + do \ + (cd $$i && $(MAKE) -e -$(MAKEFLAGS)) ;\ done + cp -f cc1/cc1 bin/cc1 + cp -f cc2/cc2 bin/cc2 + cp -f driver/$(DRIVER)/scc bin/scc -scc: lib/libcc.a - cd driver/$(DRIVER) && make $@ - -multi: lib/libcc.a +multi: for i in $(ARCHS) ; \ do \ $(MAKE) -$(MAKEFLAGS) $$i || exit ;\ done -lib/libcc.a: - cd lib && $(MAKE) -$(MAKEFLAGS) all - - -$(ARCHS): lib/libcc.a +$(ARCHS): for i in cc1 cc2; \ do \ (cd $$i; \ @@ -35,20 +31,25 @@ $(ARCHS): lib/libcc.a ln -f cc1/cc1 bin/cc1-$@ ln -f cc2/cc2 bin/cc2-$@ -install: scc +install: all mkdir -p $(PREFIX)/libexec/scc/ mkdir -p $(PREFIX)/bin/ - cp -f bin/cc[12]-* $(PREFIX)/libexec/scc/ - cp -f driver/$(DRIVER)/scc $(PREFIX)/bin/ - cd $(PREFIX)/libexec/scc/ && ln -f cc1-$(ARCH) cc1 - cd $(PREFIX)/libexec/scc/ && ln -f cc2-$(ARCH) cc2 - cd $(PREFIX)/libexec/scc/ && ln -f cc1 cpp - cd $(PREFIX)/libexec/scc/ && chmod 755 cc[12]-* cc1 cc2 cpp + cp -f bin/cc* $(PREFIX)/libexec/scc/ + cp -f bin/cc1 $(PREFIX)/bin/cpp + cp -f bin/scc $(PREFIX)/bin/ + cd $(PREFIX)/libexec/scc/ && chmod 755 cc* + cd $(PREFIX)/bin && chmod 755 cpp scc uninstall: rm -rf $(PREFIX)/libexec/scc/ rm -f $(PREFIX)/bin/scc + rm -f $(PREFIX)/bin/cpp +clean: + for i in ${DIRS};\ + do \ + (cd $$i; ${MAKE} -$(MAKEFLAGS) $@ || exit); \ + done distclean: clean - rm -f bin/cc[12]-* + rm -f bin/cc* bin/scc