d37a162f58e6358ffa1f1a30584e226d147d9b08
1 ################################################################################
2 # Desc: APC make script
5 ################################################################################
6 # This makefile builds APC, the Asset Package Compiler for Henge, on the system.
7 ################################################################################
11 YCMD
= $(YACC
) $(YFLAGS
) $<
16 RLCMD
= $(RLC
) $(RLFLAGS
) -o
$@
$<
21 CCMD
= $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@
$<
27 LDCMD
= $(LD
) $(LDFLAGS
) $(LDLIBS
) -o
$@
$^
29 # APC is built from Ragel, Bison and C source code only.
30 ySRC
:= $(shell find .
/src
-type f
-name
'*.y')
31 rlSRC
:= $(shell find .
/src
-type f
-name
'*.rl')
32 cSRC
:= $(shell find .
/src
-type f
-name
'*.c')
34 # Generated files from Yacc/Bison and Ragel
35 hGEN
:= $(ySRC
:%.y
=%.tab.h
)
36 cGEN
:= $(strip $(ySRC
:%.y
=%.tab.c
) $(rlSRC
:%.rl
=%.c
))
39 cGENDEP
= $(if
$(wildcard $1),$(subst src
/,,$(filter-out $1 \
%:,$(shell $(CC
) -MM
-MG
$1))),$(info <$1>))
40 ldFLAGS
= $(strip $(LDFLAGS
) $(LDLIBS
) $(VA_ARGS
))
43 apcSRC
:= $(patsubst %.c
,%.o
,$(cSRC
) $(cGEN
))
44 apc-dSRC
:= $(patsubst %.o
,%-d.o
,$(apcSRC
))
47 apc-d apc
: $$($$@SRC
) |
$(hGEN
)
50 %-d.o
: CFLAGS
+= -Og
-ggdb
51 %.o
%-d.o
: %.c
$$(call cGENDEP
,$$(dir $$@
)%.c
)
56 mv
$(notdir $(<:%.y
=%.tab.
[ch
])) $(dir $@
)
61 clean: $(wildcard $(cGEN
) $(hGEN
) $(apcSRC
) $(apc-dSRC
))