Clean up suffix rules

Generate .c files from .l files instead of directly a .o
Improve yacc and lex header generation dependency
This commit is contained in:
ISSOtm
2019-09-07 12:19:04 +00:00
parent 5902306271
commit 1288737c0d
2 changed files with 17 additions and 9 deletions

View File

@@ -6,6 +6,9 @@
# SPDX-License-Identifier: MIT
#
.SUFFIXES:
.SUFFIXES: .h .l .y .c .o
# User-defined variables
Q := @
@@ -66,7 +69,6 @@ rgbasm_obj := \
src/extern/utf8decoder.o \
src/version.o
src/asm/asmy.h: src/asm/asmy.c
src/asm/globlex.o src/asm/lexer.o src/asm/constexpr.o: src/asm/asmy.h
rgblink_obj := \
@@ -84,7 +86,6 @@ rgblink_obj := \
src/extern/err.o \
src/version.o
src/link/parser.h: src/link/parser.c
src/link/lexer.o: src/link/parser.h
rgbfix_obj := \
@@ -108,19 +109,24 @@ rgblink: ${rgblink_obj}
rgbfix: ${rgbfix_obj}
$Q${CC} ${REALLDFLAGS} -o $@ ${rgbfix_obj}
rgbgfx: ${rgblink_obj}
$Q${CC} ${REALLDFLAGS} ${PNGLDFLAGS} -o $@ ${rgblink_obj} ${PNGLDLIBS}
rgbgfx: ${rgbgfx_obj}
$Q${CC} ${REALLDFLAGS} ${PNGLDFLAGS} -o $@ ${rgbgfx_obj} ${PNGLDLIBS}
# Rules to process files
# We want the yacc and lex invocations to pass through our rules
.y.o:
.l.o:
# yacc- and lex-generated C files have an accompanying header
.c.h:
$Qtouch $@
.y.c:
$Q${YACC} -d ${YFLAGS} -o $@ $<
.l.o:
$Q${RM} $*.c
$Q${LEX} ${LFLAGS} -o $*.c $<
$Q${CC} ${REALCFLAGS} -c -o $@ $*.c
$Q${RM} $*.c
.l.c:
$Q${LEX} ${LFLAGS} -o $@ $<
.c.o:
$Q${CC} ${REALCFLAGS} ${PNGCFLAGS} -c -o $@ $<

2
src/link/.gitignore vendored
View File

@@ -1,2 +1,4 @@
parser.c
parser.h
lexer.c
lexer.h