mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 01:13:30 +00:00
Fix bison and flex makefile rules in trace directory.
trace/Mmakefile
Fix incorrect makefile rule with multiple targets.
A rule with multiple targets is equivalent to writing many rules,
each with one target, so the bison rule would (in parallel make)
run bison once for the .c target and once for the .h target.
The solution is to use a pattern rule, which GNU make recognises
as a single recipe generating multiple outputs.
Write separate rules for mercury_event_scanner.c and
mercury_event_scanner.h.
This commit is contained in:
@@ -235,16 +235,20 @@ trace: $(LIB_DLL_H) $(LIB_GLOBALS_H)
|
||||
|
||||
endif
|
||||
|
||||
mercury_event_parser.c mercury_event_parser.h: mercury_event_parser.y
|
||||
$(BISON) $(BISON_OPTS) -p mercury_event_ -d -o mercury_event_parser.c \
|
||||
mercury_event_parser.y
|
||||
# This uses a pattern rule to express to make that the rule's recipe is
|
||||
# responsible for making all of the targets, not individual targets.
|
||||
mercury_event_%.c mercury_event_%.h: mercury_event_%.y
|
||||
$(BISON) $(BISON_OPTS) -p mercury_event_ -d \
|
||||
-o mercury_event_$*.c mercury_event_$*.y
|
||||
|
||||
mercury_event_scanner.c mercury_event_scanner.h: \
|
||||
mercury_event_scanner.l mercury_event_parser.h
|
||||
mercury_event_scanner.c: mercury_event_scanner.l mercury_event_parser.h
|
||||
$(FLEX) $(FLEX_OPTS) -s -Pmercury_event_ \
|
||||
-omercury_event_scanner.c \
|
||||
mercury_event_scanner.l
|
||||
echo "extern int mercury_event_lex(void);" > mercury_event_scanner.h
|
||||
|
||||
# XXX does mercury_event_scanner.h need to be generated at all?
|
||||
mercury_event_scanner.h: mercury_event_scanner.c
|
||||
echo "extern int mercury_event_lex(void);" > mercury_event_scanner.h
|
||||
|
||||
RPATH_1=$(SHLIB_RPATH_OPT)$(FINAL_INSTALL_MERC_LIB_DIR)
|
||||
RPATH_2=$(SHLIB_RPATH_SEP)$(FINAL_INSTALL_MERC_GC_LIB_DIR)
|
||||
|
||||
Reference in New Issue
Block a user