1 ################################################################################
2 # Desc: Environment initialization for webcc
5 ################################################################################
6 # This file reads default Make vars and environment vars to produce a standard
7 # set of variables to compile with
8 ################################################################################
9 # Source languages handled by this build system. These languages are capable of
10 # being compiled to an intermediary format for binary output by one of the
11 # provided compilers for each language
13 # Language-specific compilers and flags passed in from environment
14 c_C
:= $(strip $(notdir $(CC
)))
15 c_FLAGS
:= $(strip $(CFLAGS
)) -I
$(SRC_DIR
)
17 cpp_C
:= $(strip $(notdir $(CXX
)))
18 cpp_FLAGS
:= $(strip $(CXXFLAGS
)) $(c_FLAGS
)
20 go_FLAGS
:= $(c_FLAGS
)
21 # Source-to-source languages handled by this build system
33 # Compiler-specific associations. Each compiler has a binary object suffix
34 # (OBJ), an archiver (AR), and an archiver object suffix (AROBJ). Each compiler
35 # may optionally have defined a linker (LD), and a binary output suffix (OUT).
41 $(cpp_C
)_LD
:= $(cc_LD
)
45 gcc_AROBJ
:= $(cc_AROBJ
)
49 emcc_AROBJ
:= $(emcc_OBJ
) #emar is just a python script that reparses shit for emcc
52 em
++_OBJ
:= $(emcc_OBJ
)
54 em
++_AROBJ
:= $(emcc_AROBJ
)
55 em
++_OUT
:= $(emcc_OUT
)
59 gccgo_AROBJ
:= $(cc_AROBJ
)
60 # Shell functions to determine what libraries can be linked by the compiler
61 cc_LDLIBS
:= $(shell ldconfig
-p | sed
-e
's@\-*[0-9\.]*\.so.*$$@@g' -e
's@\tlib@@g' -e
'/[\t ]/d')
62 gcc_LDLIBS
:= $(cc_LDLIBS
)
64 g
++_LDLIBS
:= $(cc_LDLIBS
)
66 go_LDLIBS
:= $(cc_LDLIBS
)
67 # location to build cross-compilation libraries in, not intended to be installed
69 LIB_DIR
:= $(ROOT_DIR
)/lib
$(shell uname
-m
)/$($(c_C
)_OBJ
)
70 LIBDL_DIR
:= $(LIB_DIR
)/.cache
71 LIBINC_DIR
:= $(ROOT_DIR
)/include
72 # The makefile MUST be capable of generating these directories and all of their
73 # contents. These directories are removed during the 'scrub' rule
74 MAKE_DIRS
:= $(LIB_DIR
) $(LIBDL_DIR
)
75 # Set up lib inclusions, and scan for built libs
76 c_FLAGS
+= -I
$(LIBINC_DIR
)
77 c_OBJ
:= $($(c_C
)_OBJ
)
78 # Modules are any directories other than 'DRIVER_MODULE' in 'SRC_DIR' and
79 # produce a single archive in 'SRC_DIR' containing all of the module's symbols
80 MODULES
:= $(patsubst $(SRC_DIR
)/%/,%,$(filter-out $(DRIVER_DIR
)/%,$(shell ls
-d
$(SRC_DIR
)/*/)))