X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fwebcc.git;a=blobdiff_plain;f=make%2Finit.mk;fp=make%2Finit.mk;h=4f460576badb628929a77ab8f3045a8d2d5b582d;hp=0000000000000000000000000000000000000000;hb=5d7ddfc424292ca110d60ae38d64d83fa9f16a52;hpb=695d24d66eff41e489c7016798da5311bf81777e diff --git a/make/init.mk b/make/init.mk new file mode 100644 index 0000000..4f46057 --- /dev/null +++ b/make/init.mk @@ -0,0 +1,80 @@ +################################################################################ +# Desc: Environment initialization for webcc +# Author: ksg +# Date: 2016 +################################################################################ +# This file reads default Make vars and environment vars to produce a standard +# set of variables to compile with +################################################################################ +# Source languages handled by this build system. These languages are capable of +# being compiled to an intermediary format for binary output by one of the +# provided compilers for each language +LANGS := c cpp go +# Language-specific compilers and flags passed in from environment +c_C := $(strip $(notdir $(CC))) +c_FLAGS := $(strip $(CFLAGS)) -I$(SRC_DIR) +c_SRCL := y +cpp_C := $(strip $(notdir $(CXX))) +cpp_FLAGS := $(strip $(CXXFLAGS)) $(c_FLAGS) +go_C := gccgo +go_FLAGS := $(c_FLAGS) +# Source-to-source languages handled by this build system +SLANGS := y rl +# Yacc +y_C := bison +y_FLAGS := -d +y_TRG := c h +y_STEM := tab +# Ragel +rl_C := ragel +rl_FLAGS := -C +rl_TRG := c +rl_STEM := fsm +# Compiler-specific associations. Each compiler has a binary object suffix +# (OBJ), an archiver (AR), and an archiver object suffix (AROBJ). Each compiler +# may optionally have defined a linker (LD), and a binary output suffix (OUT). +cc_OBJ := o +cc_LD := $(LD) +cc_AR := $(AR) +cc_AROBJ := a +cc_DBG := gdb +$(cpp_C)_LD := $(cc_LD) +gcc_OBJ := $(cc_OBJ) +gcc_LD := $(cc_LD) +ngcc_AR := $(cc_AR) +gcc_AROBJ := $(cc_AROBJ) +gcc_DBG := $(cc_DBG) +emcc_OBJ := bc +emcc_AR := emar +emcc_AROBJ := $(emcc_OBJ) #emar is just a python script that reparses shit for emcc +emcc_OUT := .js +g++_OBJ := $(cc_OBJ) +em++_OBJ := $(emcc_OBJ) +em++_AR := $(emcc_AR) +em++_AROBJ := $(emcc_AROBJ) +em++_OUT := $(emcc_OUT) +gccgo_OBJ := o +gccgo_LD := $(cc_LD) +gccgo_AR := $(cc_AR) +gccgo_AROBJ := $(cc_AROBJ) +# Shell functions to determine what libraries can be linked by the compiler +cc_LDLIBS := $(shell ldconfig -p | sed -e 's@\-*[0-9\.]*\.so.*$$@@g' -e 's@\tlib@@g' -e '/[\t ]/d') +gcc_LDLIBS := $(cc_LDLIBS) +emcc_LDLIBS := +g++_LDLIBS := $(cc_LDLIBS) +em++_LDLIBS := +go_LDLIBS := $(cc_LDLIBS) +# location to build cross-compilation libraries in, not intended to be installed +# in the host system +LIB_DIR := $(ROOT_DIR)/lib$(shell uname -m)/$($(c_C)_OBJ) +LIBDL_DIR := $(LIB_DIR)/.cache +LIBINC_DIR := $(ROOT_DIR)/include +# The makefile MUST be capable of generating these directories and all of their +# contents. These directories are removed during the 'scrub' rule +MAKE_DIRS := $(LIB_DIR) $(LIBDL_DIR) +# Set up lib inclusions, and scan for built libs +c_FLAGS += -I$(LIBINC_DIR) +c_OBJ := $($(c_C)_OBJ) +# Modules are any directories other than 'DRIVER_MODULE' in 'SRC_DIR' and +# produce a single archive in 'SRC_DIR' containing all of the module's symbols +MODULES := $(patsubst $(SRC_DIR)/%/,%,$(filter-out $(DRIVER_DIR)/%,$(shell ls -d $(SRC_DIR)/*/)))