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)
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
################################################################################
# Download location
HGADDR := https://hg.libsdl.org/SDL_net
-
+# Dependency libraries
+LINK_ORDER := SDL2
################################################################################
# Download location
HGADDR := https://hg.libsdl.org/SDL_ttf
+
+LINK_ORDER := SDL2
################################################################################
# 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
# 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))))))\
$(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
$(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)))
# 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)),
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
$(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))\
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)))
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
-#+STARTUP: indent
* Project Deadlines
-** October
-*** TODO APC
+** December
+*** WAITING APC
:PROPERTIES:
:ATTACH_DIR: ~/proj/the_march/src/apc
:END:
-**** TODO Directory Structure for assets
- CLOCK: [2016-10-16 Sun 11:43]--[2016-10-16 Sun 11:45] => 0:02
-#+BEGIN: clocktable :maxlevel 2 :scope subtree
-#+CAPTION: Clock summary at [2016-10-16 Sun 11:45]
-| Headline | Time |
-|--------------+--------|
-| *Total time* | *0:02* |
-|--------------+--------|
-#+END:
-
-**** TODO File syntax for directories
+**** FUNCTIONAL Directory Structure for assets
+CLOSED: [2016-11-30 Wed 09:59]
+**** FUNCTIONAL File syntax for directories
+CLOSED: [2016-11-30 Wed 10:00]
CLOCK: [2016-10-18 Tue 9:30]--[2016-10-18 Tue 10:21] => 0:51
#+BEGIN: clocktable :maxlevel 2 :scope subtree
name of archetype
numbers signify variants
alpha+ . '_m' . [digit]+ signifies mapping varriant
-***** TODO Add x,y to filenames
-**** TODO Scanner :ATTACH:
+**** REVISION Scanner :ATTACH:
:PROPERTIES:
:Attachments: scanner.c
:ID: 2dec5876-7b81-4b9c-97fe-03b152fa276a
:END:
-**** TODO Lexer :ATTACH:
+scanner to give possibly infinite children
+**** REVISION Lexer :ATTACH:
:PROPERTIES:
:Attachments: lexer.c lexer_lex.rl
:ID: faf3ff67-f8e9-41fe-9a32-2ced4bbf5b99
:END:
-**** TODO Parser/IR :ATTACH:
+ revise the scanner/lexer a little later and get these buffer sizes down a
+ little. scanner should invoke lexer_lex directly instead of making lexer
+ handle its own direntp stack.
+**** STARTED Parser/IR :ATTACH:
:PROPERTIES:
:Attachments: parser.y irmem.c ir.c ir.h
:ID: fb24c302-4743-4a45-845a-4249d2b1a378
:END:
-***** TODO Add mdats to IR to handle multiple mappings for archetypes
- CLOCK: [2016-10-20 Thu 20:12]--[2016-10-20 Thu 23:12] => 3:00
- Recording: Lexer Lex(Mapfile)
- Maps can have variants and animations. Adding a state machine
- into the lexer that will parse png files and return its frame information.
- CLOCK: [2016-10-20 Thu 19:28]--[2016-10-20 Thu 19:46] => 0:18
- insert_mdat now compiles
- CLOCK: [2016-10-20 Thu 18:10]--[2016-10-20 Thu 18:53] => 0:43
- CLOCK: [2016-10-20 Thu 15:24]--[2016-10-20 Thu 16:24] => 1:00
- CLOCK: [2016-10-20 Thu 13:13]--[2016-10-20 Thu 14:10] => 0:57
- #+BEGIN: clocktable :maxlevel 2 :scope subtree
- #+CAPTION: Clock summary at [2016-10-20 Thu 14:10]
- | Headline | Time |
- |--------------+--------|
- | *Total time* | *0:57* |
- |--------------+--------|
- #+END:
-****** DONE Create variant_list in odat
-****** DONE Init num_variants
-****** DONE Create mdat struct
-****** DONE Create new quad struct
-****** DONE Change insert_quad() to insert x,y,z, and ref_id
-****** DONE Change parser.y to include quad_list
-****** DONE In elements, populate parent_id with set. In sets, set parent_id to null.
-****** DONE Incorporate mdat into parser and ir
-****** TODO Implement Lexer_lexmapfile
-Where are we storing the map file animations? Mdats will have framesheets.
-****** TODO Remove set name token in elements being passed back
-****** DONE Lexer_lex should pass control to lexer_lexmapfile
-When it recognizes a '_m\0', call lexer_lexmapfile
-The const str passed to lexer_lex is screwing up the state machine because
-the suffix isnt truly pruned (so pe == . instead of \0)
-Mappings come before archetypes.
-****** TODO
-****** TODO
-****** TODO
-****** TODO
-****** TODO
-parent_id should be pointer or ref_id? pointer
-Root mandatory, hitbox optional? Only a variant list?
-mopen/close in skeleton rule requires lexer to pass a operator
-for every new skeleton
-inesrt_mdat() needs more?
-
**** TODO Output
DEADLINE: <2016-10-20 Thu>
+** Christmas Holiday (December 21 - January 5)
*** TODO Test Suite for APC
- DEADLINE: <2016-10-20 Thu>
+DEADLINE: <2016-12-31 Sat>
*** TODO Animation Viewer
- DEADLINE: <2016-10-31 Mon>
+DEADLINE: <2017-01-07 Sat>
-** November
+** January
*** TODO Core State Machine
- DEADLINE: <2016-11-10 Thu>
*** TODO Renderer
- DEADLINE: <2016-11-10 Thu>
-*** TODO World Generator - Beta
- DEADLINE: <2016-11-20 Sun>
+*** TODO World Generator
*** TODO Core Improvements
- DEADLINE: <2016-11-20 Sun>
*** TODO Front-end Hooks
- DEADLINE: <2016-11-20 Sun>
-*** TODO World Generator - Stable
- DEADLINE: <2016-11-30 Wed>
*** TODO Physics Engine
- SCHEDULED: <2016-11-30 Wed>
- DEADLINE: <2016-12-20 Tue>
*** TODO Actors
- DEADLINE: <2016-11-30 Wed>
*** TODO Audio Backend
- DEADLINE: <2016-11-30 Wed>
-
-** December
+** February
*** TODO Account Management
- DEADLINE: <2016-12-10 Sat>
*** TODO User Management
- DEADLINE: <2016-12-10 Sat>
-*** TODO Controllers - Beta
- DEADLINE: <2016-12-10 Sat>
+*** TODO Controllers
*** TODO Internal Data Handling
- DEADLINE: <2016-12-10 Sat>
*** TODO Network Skeleton
- DEADLINE: <2016-12-10 Sat>
*** TODO Social Media
- SCHEDULED: <2016-12-10 Sat>
*** TODO Core Gameplay
- SCHEDULED: <2016-12-20 Tue>
-*** TODO Account Management - Stable
- DEADLINE: <2016-12-20 Tue>
-*** TODO Controllers - Stable
- DEADLINE: <2016-12-20 Tue>
-
-** Christmas Holiday (December 21 - January 5)
*** TODO Gameplay Developments
*** TODO Front-End Improvements (remote)
*** TODO AI Start
*** TODO Website Beta
-
-** January
+** March
*** TODO Gameplay - Win Conditions
- DEADLINE: <2017-01-10 Tue>
*** TODO Social Media Integration
- DEADLINE: <2017-01-10 Tue>
*** TODO Viable AI (Lua ^ JS)
- DEADLINE: <2017-01-20 Fri>
-
-** February
*** TODO Beta Deployment
- DEADLINE: <2017-02-01 Wed>
*** TODO Multiplay Beta
- DEADLINE: <2017-02-01 Wed>
*** TODO Early Access for Marketing
- DEADLINE: <2017-02-01 Wed>
-
-
-
-
* Notes
11/2 Changes to grammar
why?
** DONE Fix all shift/reduce errors in new grammar
** DONE Add map variant changes (create new odat, share vdat)
+<<<<<<< HEAD
+
+=======
+** DONE Add map operator changes to lexer.c
+** DONE Rename mapping files
+** TODO Review parser.y, irmem.c, ir.c, ir.h, lexer.c
+
+
+#+STARTUP: ident
+#+TODO: TODO(t) STARTED(s) WAITING(w) | FUNCTIONAL(f)
+#+TODO: BUG(b) REVISION(r) UPDATING(u) | DONE (d)
+#+TODO: | CANCELED(c)
+>>>>>>> 5666c47853b4499c510f9e342d722841e4f6a5e0
*/
int scanner
#define $($)#$ //stringifier
-#ifdef _DIRENT_HAVE_D_NAMLEN
-#define MAX_DNAME _D_ALLOC_NAMLEN(DL_CD())
-#else
-#define MAX_DNAME 1024
-#endif
#define ERR_CHILD "Fatal: Maximum of " $(DL_CD_STACKSIZE) \
" child directories exceeded for directory at depth %i\n" \
,DL_LEN()
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;