From: ken Date: Wed, 16 Nov 2016 22:24:26 +0000 (-0800) Subject: merged X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fwebcc.git;a=commitdiff_plain;h=3d03d8941abeb2a78f3334098a7bd09285023da8 merged --- 3d03d8941abeb2a78f3334098a7bd09285023da8 diff --cc make/SDL2.mk index 2b85c1d,2b85c1d..387d6a8 --- a/make/SDL2.mk +++ b/make/SDL2.mk @@@ -9,9 -9,9 +9,8 @@@ HGADDR := https://hg.libsdl.org/SDL # No autogen for SDL undefine AUTOGEN --# Ensure we have our other libraries, and their associated --# accutrements (like jpeg/tiff, etc from SDL2_image) LIBDEPS := SDL2_image SDL2_ttf SDL2_net ++LINK_ORDER := # Modifications to the build process when using specific compilers define emccMOD = $(eval CONFIGURE += --enable-joystick=no) diff --cc make/SDL2_image.mk index ed96b59,ed96b59..8ca8a89 --- a/make/SDL2_image.mk +++ b/make/SDL2_image.mk @@@ -9,3 -9,3 +9,4 @@@ HGADDR := https://hg.libsdl.org/SDL_image # SDL2_image depends on zlib, libpng, libtiff libpjeg, and libwebp LIBDEPS := webp png tiff z ++LINK_ORDER := SDL2 webp png tiff z diff --cc make/SDL2_net.mk index 04f4d4c,04f4d4c..2f73859 --- a/make/SDL2_net.mk +++ b/make/SDL2_net.mk @@@ -7,4 -7,4 +7,5 @@@ ################################################################################ # Download location HGADDR := https://hg.libsdl.org/SDL_net -- ++# Dependency libraries ++LINK_ORDER := SDL2 diff --cc make/SDL2_ttf.mk index 298db62,298db62..508e696 --- a/make/SDL2_ttf.mk +++ b/make/SDL2_ttf.mk @@@ -7,3 -7,3 +7,5 @@@ ################################################################################ # Download location HGADDR := https://hg.libsdl.org/SDL_ttf ++ ++LINK_ORDER := SDL2 diff --cc make/lib/rules.mk index c798491,c798491..2f5944b --- a/make/lib/rules.mk +++ b/make/lib/rules.mk @@@ -1,6 -1,6 +1,6 @@@ ################################################################################ # Desc: Make functions for creating rules (Make making Make) --# Author: Ken Grimes ++# Author: ksg # Date: 2016 ################################################################################ # This file consists of library functions for make-making-make functionality @@@ -19,7 -19,7 +19,7 @@@ ende # available in the current working directory of the source file(i.e. if you # '#include "something.h"' in 'mymodule/horseradish.c', you would expect to # include 'mymodule/something.h'. this check lets that happen), otherwise it is --# some kind of user error ####################################################### ++# some kind of user error ###################################################### define SRC_LANG_RULE = $(if $($1),,$(eval $1 := t)\ $(eval MOD := $(filter $(MODULES),$(firstword $(subst /, ,$(subst $(SRC_DIR),,$(dir $1))))))\ @@@ -49,9 -49,9 +49,9 @@@ $(foreach dep,$(RELDEPS) $(eval ALLDEPS := $(subst $(dep),\ $(if $(wildcard $(LIBINC_DIR)/$(dep)),$(LIBINC_DIR),$(SRC_DIR))/$(dep),$(ALLDEPS)))) --# Find any deps that aren't built yet, which the compiler has flagged --# as missing, but which we know the expected location of libs for --# this language should have their includes in 'LIBINC_DIR' ++# Find any deps that aren't built yet, which the compiler has flagged as ++# missing, but which we know the expected location of libs for this language ++# should have their includes in 'LIBINC_DIR' $(eval BUILDDEPS := $(filter $($2_LIBS:%=%/%),$(ALLDEPS))) $(eval ALLDEPS := $(filter-out $(BUILDDEPS),$(ALLDEPS)) $(BUILDDEPS:%=$(LIBINC_DIR)/%)) # Object for $1 @@@ -66,11 -66,11 +66,35 @@@ $(eval MAKE_TARGETS += $(DBG_OBJ) $(DBG_OBJ): $(ALLDEPS) | $(dir $(DBG_OBJ)) $($2_C) $$($2_FLAGS) $(FLG) -Og -g$($2_DBG) -c -o $$@ $1 )) --#/SRC_LANG_RULE################################################################## ++#/SRC_LANG_RULE################################################################# endef --#SRC_LANG_DRVRULE################################################################ --# establish a build and link rule given a source driver and language ############ ++#LANG_LIB_DEPLIST############################################################### ++# Crawl the tree of dependencies for static libraries, terminating at root ++# dependencies or any dynamic link ############################################# ++define LANG_LIB_DEPLIST = ++$(if $($2_INIT),,$(call LANG_LIB_INIT,$1,$2)) ++$(foreach dep,$($2_DEPS) ++endef ++ ++ ++define LIB_PARSELINKS = ++$( ++$(eval DLIBS := $(patsubst +%,%,$(filter +%,$(LINK_ORDER)))) ++$(eval SLIBS := $(patsubst -%,%,$(filter -%,$(LINK_ORDER)))) ++$(foreach ldobj,$(patsubst +%,%,$(LINK_ORDER:-%=%)), ++$(if $(or $(filter $(ldobj),$(DLIBS)),$(and $(filter-out $(SLIBS),$(ldobj)), $(filter $(ldobj),$($($2_C)_LDLIBS)))), ++$(eval DRIVER_LDINFO += -l$(ldobj)), ++$(if $(filter $(ldobj),$(MODULES)), ++$(eval DRIVER_LDINFO += $(SRC_DIR)/$(ldobj).$($2_AROBJ)) ++$(eval DRIVER_LDINFO_D += $(SRC_DIR)/.$($2_DBG)/$(ldobj).$($2_AROBJ)), ++$(if $($(ldobj)_INIT),,$(call LANG_LIB_INIT,$2,$(ldobj),$1)) ++$(foreach dep,$($(ldobj)_DEPS) ++ ++endef ++ ++#SRC_LANG_DRVRULE############################################################### ++# establish a build and link rule given a source driver and language ########### define SRC_LANG_DRVRULE = $(eval DRIVER_NAME := $(basename $(notdir $1))) $(eval DRIVER_TARG := $(1:$(SRC_DIR)/%.$2=$(ROOT_DIR)/%$($2_OUT))) @@@ -98,18 -98,18 +122,30 @@@ $(eval DRIVER_MODULES := $(filter-out $ # available, all libraries will attempt static linking - and if those static # libs are not available, the system will attempt to retrieve the source code # and build the static lib --$(eval DRIVER_LDFILE := $(1:%.$2=%.ld)) ++$(eval DRIVER_LDFILE := $(1:%.$2=%.mk)) $(if $(filter test%,$(DRIVER_NAME)), --$(eval DRV_LD := $(subst $(DRIVER_NAME).$2,$(DRIVER_NAME:test%=%).ld,$1)) ++$(eval DRV_LD := $(subst $(DRIVER_NAME).$2,$(DRIVER_NAME:test%=%).mk,$1)) $(if $(wildcard $(DRV_LD)), $(eval DRIVER_LDFILE := $(DRV_LD)) )) --$(eval $1_LD := $(file <$(DRIVER_LDFILE))) ++$(eval undefine LINK_ORDER) ++$(eval undefine LINK_ORDER_D) ++$(eval $(file <$(DRIVER_LDFILE))) $(eval undefine DRIVER_LDINFO) $(eval undefine DRIVER_LDINFO_D) $(eval DRIVER_LDINFO += $(1:%.$2=%.$($2_OBJ))) $(eval DRIVER_LDINFO_D += $(1:$(dir $1)%.$2=$(dir $1).$($2_DBG)/%.$($2_OBJ))) --$(foreach ldobj,$($1_LD), ++$(eval DLIBS := $(patsubst +%,%,$(filter +%,$(LINK_ORDER)))) ++$(eval SLIBS := $(patsubst -%,%,$(filter -%,$(LINK_ORDER)))) ++$(foreach ldobj,$(patsubst +%,%,$(LINK_ORDER:-%=%)), ++$(if $(or $(filter $(ldobj),$(DLIBS)),$(and $(filter-out $(SLIBS),$(ldobj)), $(filter $(ldobj),$($($2_C)_LDLIBS)))), ++$(eval DRIVER_LDINFO += -l$(ldobj)), ++$(if $(filter $(ldobj),$(MODULES)), ++$(eval DRIVER_LDINFO += $(SRC_DIR)/$(ldobj).$($2_AROBJ)) ++$(eval DRIVER_LDINFO_D += $(SRC_DIR)/.$($2_DBG)/$(ldobj).$($2_AROBJ)), ++$(if $($(ldobj)_INIT),,$(call LANG_LIB_INIT,$2,$(ldobj),$1)) ++$(foreach dep,$($(ldobj)_DEPS) ++ $(if $(filter -l%,$(ldobj)), $(eval ldlibname := $(ldobj:-l%=%)) $(if $(filter $(ldlibname),$($($2_C)_LDLIBS)), @@@ -259,7 -259,7 +295,7 @@@ MKCMD := make - MKINSTALL := make -k install MKCLEAN := make clean MKDBGCMD := make -k --LIBDEPS := ++LINK_ORDER := LIBLANGS := c cpp go LIBLDPATH := $(if $($($1_C)_LD),$(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):,/usr/lib:)$(abspath $(LIB_DIR))) # One of these must be defined in the .mk file imported @@@ -269,16 -269,16 +305,18 @@@ $(eval undefine $(var)) $(foreach var, WEBTARG WEBINIT CVSGET CVSPASS CONFIGUREDBG, $(eval undefine $(var))) ) --# If there is a .mk file for this lib, import it. Otherwise, we'll try to link --# it later, unless there is no linker for the language's compiler. ++# If there is a .mk file for this lib, import it. Otherwise, inform user of ++# error $(if $(wildcard $(CONF_DIR)/$2.mk),$(eval $(file <$(CONF_DIR)/$2.mk)),\ --$(if $($($1_C)_LD),\ --$(warning No $2.mk for lib$2, attempting to link from the system),\ --$(error No $2.mk for lib$2 and '$($1_C)' is not configured for linking)))\ ++$(error Expected $(CONF_DIR)/$2.mk for lib$2)) # Add dependencies we found (potentially recursively, ignore repeats until later # so we can preserve ordering information for interdependency build ordering) --$(if $(LIBDEPS),\ ++$(eval undefine $2_LDINFO) ++$(foreach ldobj,$(LINK_ORDER),\ ++$(eval $2_LDINFO += ++) ++$(if $(LINK_ORDER),\ $(eval $1_LIBS += $(LIBDEPS))\ $(if $3,$(eval $3_DEPS += $(LIBDEPS)))\ $(eval $2_DEPS += $(LIBDEPS))\ @@@ -349,7 -349,7 +387,7 @@@ $(eval $(call SRC_LANG_RULE,$(src),$1)) endef # Create a phony target and rule for the specified source driver --define DRVSRC_DRIVERPHONY ++define DRVSRC_DRIVERPHONY = $(eval PH_TARG := $(basename $(notdir $1))) $(eval PH_TARGS += $(PH_TARG)) $(eval PH_LANG := $(lastword $(subst ., ,$1))) diff --cc make/png.mk index 320f4be,320f4be..a28aed1 --- a/make/png.mk +++ b/make/png.mk @@@ -19,3 -19,3 +19,5 @@@ CONFIGURE += && sed -i -e 's@^DEFAULT_I CONFIGURE += && sed -i -e 's@^LIBS \= \-lz@LIBS = -L$(abspath $(LIB_DIR))@g' ./Makefile # Don't check MKCMD := make -k ++# png can be built with zlib for efficiency ++LINK_ORDER := z diff --cc src/apc/scanner.c index 5611c95,b1b7998..55245af --- a/src/apc/scanner.c +++ b/src/apc/scanner.c @@@ -143,7 -148,7 +143,11 @@@ int scanne if (DL_CD_LEN() > 0) //There are entities to process { if (DL_CD_POP() == NULL) //If the dirent is null, then the goto libfail; //lib function in dirent has failed ++<<<<<<< HEAD + ntok += lexer_lexstring(DL_CD_CURNAME());//lex the directory name ++======= + ntok += lexer_lexstring(DL_CD_CURNAME()); //lex the directory name ++>>>>>>> 15d3ab5e7871ff459af13089b82bf5f17f731ebd if (DL_LEN() >= DL_STACKSIZE) //fail if maxdepth exceeded { fprintf(stderr, ERR_DEPTH); goto fail;