projects
/
henge
/
apc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ea23aba
)
gcc linker, ragel now makes '.fsm.c' files from equivalent '.rl' files
author
ken
<ken@mihrtec.com>
Sat, 17 Dec 2016 00:24:42 +0000
(16:24 -0800)
committer
ken
<ken@mihrtec.com>
Sat, 17 Dec 2016 00:24:42 +0000
(16:24 -0800)
Makefile
patch
|
blob
|
history
diff --git
a/Makefile
b/Makefile
index
6076653
..
079c4cc
100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-27,10
+27,10
@@
CCMD = $(strip $(CC) $(CFLAGS) $(CPPFLAGS) -c $(if $2,-o $2) $1)
# Linker
LD ?= ld
LDFLAGS ?=
# Linker
LD ?= ld
LDFLAGS ?=
-LDLIBS ?= -l
c -l
unistring
+LDLIBS ?= -lunistring
apcLIBS ?=
apc-dLIBS ?=
apcLIBS ?=
apc-dLIBS ?=
-LDCMD = $(strip
$(LD)
$(LDFLAGS) $(if $2,-o $2) $1) $(LDLIBS) $($1LIBS)
+LDCMD = $(strip
gcc
$(LDFLAGS) $(if $2,-o $2) $1) $(LDLIBS) $($1LIBS)
# APC is built from Ragel, Bison and C source code only.
ySRC := $(shell find ./src -type f -name '*.y')
# APC is built from Ragel, Bison and C source code only.
ySRC := $(shell find ./src -type f -name '*.y')
@@
-39,7
+39,7
@@
cSRC := $(shell find ./src -type f -name '*.c')
# Generated files from Yacc/Bison and Ragel
hGEN := $(ySRC:%.y=%.tab.h)
# Generated files from Yacc/Bison and Ragel
hGEN := $(ySRC:%.y=%.tab.h)
-cGEN := $(strip $(ySRC:%.y=%.tab.c) $(rlSRC:%.rl=%.c))
+cGEN := $(strip $(ySRC:%.y=%.tab.c) $(rlSRC:%.rl=%.
fsm.
c))
# Filter all other driver objects out of each driver's link commands.
OBJ := $(patsubst %.c,%.o,$(cSRC) $(cGEN))
# Filter all other driver objects out of each driver's link commands.
OBJ := $(patsubst %.c,%.o,$(cSRC) $(cGEN))
@@
-48,19
+48,14
@@
$(eval OTHERS := $(filter-out $(drv),$(DRIVERS)))\
$(eval $(drv)SRC := $(filter-out $(OTHERS:%=\%/%.o),$(OBJ)))\
$(eval $(drv)-dSRC := $($(drv)SRC:%.o=%-d.o)))
$(eval $(drv)SRC := $(filter-out $(OTHERS:%=\%/%.o),$(OBJ)))\
$(eval $(drv)-dSRC := $($(drv)SRC:%.o=%-d.o)))
-# Unless cleaning, deps should be generated for each source file
ifeq (,$(filter clean,$(MAKECMDGOALS)))
ifeq (,$(filter clean,$(MAKECMDGOALS)))
+# Deps should be generated for each source file, when not cleaning
cGENDEP = $(if $(wildcard $1),$(subst $(dir $1),,$(filter-out $1 \ %:,$(shell $(CC) -MM -MG $1))),\
$(info [<$1>: no deps - file not found]))
cGENDEP = $(if $(wildcard $1),$(subst $(dir $1),,$(filter-out $1 \ %:,$(shell $(CC) -MM -MG $1))),\
$(info [<$1>: no deps - file not found]))
-endif
-
-# Construct the S2S function for generating source files during prerequisite
-# expansion:
-# If we are cleaning, stop. Else print the result of calling '1'. Then, unless
-# we are in -n mode, invoke the result of calling '1' in the shell
-ifeq (,$(filter clean,$(MAKECMDGOALS)))
+# S2S will print the command necessary to create a file when called
S2S = $(info $(call $1,$2,$3))
ifeq (,$(filter n,$(MAKEFLAGS)))
S2S = $(info $(call $1,$2,$3))
ifeq (,$(filter n,$(MAKEFLAGS)))
+# Unless we're in -n mode, S2S should also invoke the command on the shell
S2S += $(shell $(call $1,$2,$3))
endif
endif
S2S += $(shell $(call $1,$2,$3))
endif
endif
@@
-76,7
+71,7
@@
$(DRIVERS:%=%-d) $(DRIVERS): $$($$@SRC) | $(hGEN)
%.tab.h: %.tab.c ;
%.tab.c: %.y $$(call S2S,YCMD,%.y,$$@) ;
%.tab.h: %.tab.c ;
%.tab.c: %.y $$(call S2S,YCMD,%.y,$$@) ;
-%.c: %.rl $$(call S2S,RLCMD,%.rl,$$@) ;
+%.
fsm.
c: %.rl $$(call S2S,RLCMD,%.rl,$$@) ;
clean: $(wildcard $(cGEN) $(hGEN) $(foreach drv,$(DRIVERS),$($(drv)SRC) $($(drv)-dSRC)))
$(if $^,rm $^)
clean: $(wildcard $(cGEN) $(hGEN) $(foreach drv,$(DRIVERS),$($(drv)SRC) $($(drv)-dSRC)))
$(if $^,rm $^)