Build System +Tool specific compilers and targets
[henge/webcc.git] / src / Makefile
index 89aba0e..64a42a1 100644 (file)
@@ -15,7 +15,7 @@ APPFLAGS  :=
 APPOBJ    :=
 #Dependencies which must be built before the executable
 APPDEPS   :=
-#Directories containing independent tools
+#Directories containing independent tools for GNU
 TOOLS     := apc
 ##################################################
 #Emscripten Info
@@ -77,9 +77,16 @@ TOOLTARGS := $(foreach tool,$(TOOLS),$(tool)/$(tool))
 $(TOOLS): $(TOOLTARGS)
 
 T = $(notdir $@)
+B = $(basename $T)
 $(TOOLTARGS): $(TOOLOBJ)
        $($TCC) $($TFLG) $($TSRC:.c=.o) -o $@
 
+#Tools only work on whatever system they're designed for
+#(typically GNU), so their creation rules are dependent
+#on each tool (define in .make/.buildtools.mk)
+$(foreach tool,$(TOOLS),$(tool)/%.o): %.c
+       $($BCC) $(BFLG) $< -c -o $@
+
 #Put our toolsrc on the ctarg list for generating deps
 CTARG := $(CTARG) $(TOOLOBJ)
 endif