Buildsys2
[henge/webcc.git] / src / .make / buildclibs.mk
1 ##################################################
2 #Desc: Missing CLib Generator
3 #Author: Mihrtec LLC
4 #Date: 2016
5 ##################################################
6 #Included from buildc.make
7 #Defines vars for automatically downloading,
8 #compiling, and linking GNU-like C libraries
9 ##################################################
10
11 #Missing libraries will be downloaded
12 #to MLSRCDIR and installed at MLLIBDIR
13 MLDIR := /usr/local
14 MLSRCDIR := $(MLDIR)/src
15 #If we aren't compiling for our own environment,
16 #we need to create a directory for that type of
17 #transpiled library
18 ARCHLOCAL := $(shell uname -m | grep "$(CARCH)")
19 MLLIBDIR := $(if $(ARCHLOCAL),$(MLDIR)/lib,$(MLDIR)/lib$(CARCH))
20
21 #Modify the dependency generator to find the right directory for
22 #missing lib includes (they are in MLDIR/src/libname/libname)
23 CDEPSCOMMAND += $(patsubst %, | sed -e 's@ \(%\)/@$(MLSRCDIR)/\1/\1/@',$(MISSINGLIBS))
24
25 #Automake vars for building libs
26 AMGEN ?= ./autogen.sh
27 AMCONF ?= ./configure
28 AMMAKE ?= make
29
30 #Import the headers for each missing library (XTDIR/LIBNAME)
31 CFLAGS += -L$(MLLIBDIR) $(patsubst %,-I$(MLSRCDIR)/%,$(MISSINGLIBS))
32
33 #Notify user of libraries that are about to be built
34 $(info Libraries to be built in $(MLLIBDIR):)
35 $(info $(patsubst %,lib%.so,$(MISSINGLIBS)))
36 STATICLIBS := $(patsubst %,$(MLLIBDIR)/lib%.so,$(MISSINGLIBS))
37
38 #Ensure that C files depend on the creation of these static libs
39 CDEPS += $(STATICLIBS)
40