ack/util/topgen/build.mk
David Given 07453d184a Top, topgen, aelflod. Moved the libraries back into the platform-specific
directories --- wrangling descr files was too hard. C programs can be built
for cpm, pc86, linux386, linux68k!

--HG--
branch : dtrg-buildsystem
rename : util/ack/build.mk => util/led/build.mk
rename : util/LLgen/build.mk => util/topgen/build.mk
2013-05-13 23:26:15 +01:00

51 lines
1 KiB
Makefile

D := util/topgen
# Rule to build topgen.
define build-topgen-impl
$(call reset)
$(eval cflags += -I$(OBJDIR)/$D -I$D)
$(call cfile, $D/LLlex.c)
$(call cfile, $D/hash.c)
$(call cfile, $D/main.c)
$(call cfile, $D/pattern.c)
$(call cfile, $D/symtab.c)
$(eval $q: $(OBJDIR)/$D/Lpars.h)
$(call llgen, $(OBJDIR)/$D, $D/topgen.g)
$(call file, $(LIBASSERT))
$(call file, $(LIBPRINT))
$(call file, $(LIBALLOC))
$(call file, $(LIBSYSTEM))
$(call file, $(LIBSTRING))
$(call cprogram, $(BINDIR)/topgen)
TOPGEN := $o
endef
$(eval $(build-topgen-impl))
# Rule to invoke to *use* LLgen.
#
# $1: directory to put output files
# $2: input files
#
# Output files are *not* compiled (gen.c is expected to be included by
# something).
define topgen-impl
$(eval CLEANABLES += $1/gen.h $1/gen.c)
$1/gen.h: $1/gen.c
$1/gen.c: $2 $(TOPGEN)
@echo TOPGEN $$@
@mkdir -p $$(dir $$@)
$(hide) $(RM) $1/gen.h $1/gen.c
$(hide) cd $$(dir $$@) && $(abspath $(TOPGEN)) $(abspath $2)
endef
topgen = $(eval $(call topgen-impl,$1,$2))