alloca() chokes badly on Borland
[fw/sdcc] / Makefile
index c52fa602f482db39be4d45cd6ed50c412dd2f523..fe11386e14f05206b1899645aa110e5ba2c3d21a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,25 +2,66 @@
 #
 #
 
+CFLAGS+=-g
+
 SHELL          = /bin/sh
 AUTOCONF       = autoconf
 
 PRJDIR         = .
-PKGS           = support/gc support/cpp \
-                 src as/mcs51 debugger/mcs51 \
-                 device/include device/lib sim/mcs51
-PRJS           = sim/mcs51
-PORTS          = mcs51 z80
-
 srcdir          = .
+include $(srcdir)/Makefile.common
+
+SDCC_MISC      = debugger/mcs51 sim/ucsim
+SDCC_LIBS      = support/cpp
+SDCC_ASLINK    = as/mcs51 as link
+SDCC_PACKIHX   = packihx
 
+PKGS           = $(SDCC_MISC) $(SDCC_LIBS) $(SDCC_ASLINK) \
+                 src device/include device/lib $(SDCC_PACKIHX)
+PKGS_TINI      = $(SDCC_LIBS) $(SDCC_ASLINK) \
+                 src device/include $(SDCC_PACKIHX)
+PORTS          = $(shell cat ports.build)
+ALLPORTS       = $(shell cat ports.all)
 
 # Compiling entire program or any subproject
 # ------------------------------------------
-all: checkconf
-       for pkg in $(PKGS); do $(MAKE) -C $$pkg; done
+all: checkconf sdcc
+
+tini: checkconf sdcc-tini
+
+sdcc-libs:
+       for lib in $(SDCC_LIBS); do $(MAKE) -C $$lib; done
+
+sdcc-cc: sdcc-libs
+       $(MAKE) -C src
+
+sdcc-aslink:
+       for as in $(SDCC_ASLINK); do $(MAKE) -C $$as; done
+
+sdcc-misc:
+       for misc in $(SDCC_MISC); do $(MAKE) -C $$misc; done
+
+sdcc-packihx:
+       $(MAKE) -C $(SDCC_PACKIHX)
+
+sdcc-device:
+       $(MAKE) -C device/include
+       $(MAKE) -C device/lib
+
+sdcc-device-tini:
+       $(MAKE) -C device/include
+       $(MAKE) -C device/lib modelDS390
+
+sdcc: sdcc-cc sdcc-aslink sdcc-misc sdcc-device sdcc-packihx
        $(MAKE) -f main.mk all
 
+sdcc-tini: sdcc-cc sdcc-aslink sdcc-device-tini sdcc-packihx
+       $(MAKE) -f main.mk all
+
+# Some interesting sub rules
+sdcc-bin: sdcc-cc sdcc-aslink sdcc-misc
+
+sdcc-base: sdcc-cc sdcc-aslink
 
 # Compiling and installing everything and runing test
 # ---------------------------------------------------
@@ -30,6 +71,14 @@ install:
          $(MAKE) -C $$pkg install ;\
        done
 
+install-tini:
+       $(MAKE) -f main.mk install
+       @for pkg in $(PKGS_TINI); do\
+         $(MAKE) -C $$pkg install ;\
+       done
+       $(MAKE) -C device/lib installDS390
+
+
 
 # Deleting all the installed files
 # --------------------------------
@@ -49,10 +98,6 @@ clean:
        for pkg in $(PKGS); do\
          $(MAKE) PORTS="$(PORTS)" -C $$pkg clean ;\
        done
-       @echo "+ Cleaning sub-projects using Makefile..."
-       for prj in $(PRJS); do\
-         $(MAKE) -C $$prj clean ;\
-       done
 
 
 # Deleting all files created by configuring or building the program
@@ -64,10 +109,6 @@ distclean:
        for pkg in $(PKGS); do\
          $(MAKE) -C $$pkg -f clean.mk PORTS="$(PORTS)" distclean ;\
        done
-       @echo "+ DistCleaning sub-projects using Makefile..."
-       for prj in $(PRJS); do\
-         $(MAKE) -C $$prj distclean ;\
-       done
 
 
 # Like clean but some files may still exist
@@ -77,9 +118,6 @@ mostlyclean: clean
        for pkg in $(PKGS); do\
          $(MAKE) -C $$pkg -f clean.mk PORTS="$(PORTS)" mostlyclean ;\
        done
-       for prj in $(PRJS); do\
-         $(MAKE) -C $$prj mostlyclean ;\
-       done
 
 
 # Deleting everything that can reconstructed by this Makefile. It deletes
@@ -90,9 +128,6 @@ realclean: distclean
        for pkg in $(PKGS); do\
          $(MAKE) -C $$pkg -f clean.mk PORTS="$(PORTS)" realclean ;\
        done
-       for prj in $(PRJS); do\
-         $(MAKE) -C $$prj realclean ;\
-       done
 
 
 # Creating distribution