Buildsys2
[henge/webcc.git] / src / .make / buildc.mk
index 48e9d0a..310929e 100644 (file)
@@ -70,6 +70,19 @@ LDSED  ?= sed -e 's@^.*cannot find -l\([a-zA-Z0-9\.]*\).*@\1@g'
 #Calculate missing libs
 MISSINGLIBS ?= $(strip $(shell $(LDPIPE) | $(LDGREP) | $(LDSED)))
 
+#Missing libraries will be downloaded
+#to MLSRCDIR and installed at MLLIBDIR
+MLDIR    := /usr/local
+MLSRCDIR := $(MLDIR)/src
+#If we aren't compiling for our own environment,
+#we need to create a directory for that type of
+#transpiled library
+ARCHLOCAL := $(shell uname -m | grep "$(CARCH)")
+MLLIBDIR  := $(if $(ARCHLOCAL),$(MLDIR)/lib,$(MLDIR)/lib$(CARCH))
+
+CFLAGS += -L$(MLLIBDIR)
+CFLAGS += $(patsubst %,-I$(MLSRCDIR)/%,$(CLIBS))
+
 #Include handler for building missing libs, if any
 ifdef MISSINGLIBS
 include .make/buildclibs.mk