mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Allow CFLAGS to be modified from make command line
Previously, if the user wanted to modify CFLAGS, it was necessary to add the options used in the Makefile as well, which doesn't make sense. This patch splits CFLAGS into CFLAGS and the previously removed REALCFLAGS so that the user can modify the arguments passed to the compiler without having to worry about things like passing the list of include directories. Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
19
Makefile
19
Makefile
@@ -16,7 +16,12 @@ PNGLDFLAGS := `${PKG_CONFIG} --static --libs-only-L libpng`
|
|||||||
PNGLDLIBS := `${PKG_CONFIG} --static --libs-only-l libpng`
|
PNGLDLIBS := `${PKG_CONFIG} --static --libs-only-l libpng`
|
||||||
|
|
||||||
WARNFLAGS := -Wall -Werror
|
WARNFLAGS := -Wall -Werror
|
||||||
CFLAGS := ${WARNFLAGS} -g -std=c99 -D_POSIX_C_SOURCE=200809L -Iinclude
|
|
||||||
|
# Overridable CFLAGS
|
||||||
|
CFLAGS := -g
|
||||||
|
# Non-overridable CFLAGS
|
||||||
|
REALCFLAGS := ${CFLAGS} ${WARNFLAGS} -std=c99 -D_POSIX_C_SOURCE=200809L \
|
||||||
|
-Iinclude
|
||||||
|
|
||||||
YFLAGS :=
|
YFLAGS :=
|
||||||
LFLAGS := --nounistd
|
LFLAGS := --nounistd
|
||||||
@@ -77,16 +82,16 @@ rgbgfx_obj := \
|
|||||||
src/extern/err.o
|
src/extern/err.o
|
||||||
|
|
||||||
rgbasm: ${rgbasm_obj}
|
rgbasm: ${rgbasm_obj}
|
||||||
$Q${CC} ${CFLAGS} -o $@ ${rgbasm_obj} -lm
|
$Q${CC} ${REALCFLAGS} -o $@ ${rgbasm_obj} -lm
|
||||||
|
|
||||||
rgblink: ${rgblink_obj}
|
rgblink: ${rgblink_obj}
|
||||||
$Q${CC} ${CFLAGS} -o $@ ${rgblink_obj}
|
$Q${CC} ${REALCFLAGS} -o $@ ${rgblink_obj}
|
||||||
|
|
||||||
rgbfix: ${rgbfix_obj}
|
rgbfix: ${rgbfix_obj}
|
||||||
$Q${CC} ${CFLAGS} -o $@ ${rgbfix_obj}
|
$Q${CC} ${REALCFLAGS} -o $@ ${rgbfix_obj}
|
||||||
|
|
||||||
rgbgfx: ${rgbgfx_obj}
|
rgbgfx: ${rgbgfx_obj}
|
||||||
$Q${CC} ${CFLAGS} ${PNGLDFLAGS} -o $@ ${rgbgfx_obj} ${PNGLDLIBS}
|
$Q${CC} ${REALCFLAGS} ${PNGLDFLAGS} -o $@ ${rgbgfx_obj} ${PNGLDLIBS}
|
||||||
|
|
||||||
# Rules to process files
|
# Rules to process files
|
||||||
|
|
||||||
@@ -96,11 +101,11 @@ rgbgfx: ${rgbgfx_obj}
|
|||||||
.l.o:
|
.l.o:
|
||||||
$Q${RM} $*.c
|
$Q${RM} $*.c
|
||||||
$Q${LEX} ${LFLAGS} -o $*.c $<
|
$Q${LEX} ${LFLAGS} -o $*.c $<
|
||||||
$Q${CC} ${CFLAGS} -c -o $@ $*.c
|
$Q${CC} ${REALCFLAGS} -c -o $@ $*.c
|
||||||
$Q${RM} $*.c
|
$Q${RM} $*.c
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$Q${CC} ${CFLAGS} ${PNGCFLAGS} -c -o $@ $<
|
$Q${CC} ${REALCFLAGS} ${PNGCFLAGS} -c -o $@ $<
|
||||||
|
|
||||||
# Target used to remove all files generated by other Makefile targets.
|
# Target used to remove all files generated by other Makefile targets.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user