From: Andre Noll Date: Sun, 25 Apr 2021 22:56:16 +0000 (+0200) Subject: build: Improve handling of compiler options. X-Git-Tag: v1.0.4~5^2~1 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=73d2280b56e07b3115c14deaa994114a462afd33;p=lopsub.git build: Improve handling of compiler options. Introduce LLS_CFLAGS and STRICT_CFLAGS to avoid duplicating the flags in the various cc recipes. We don't touch CFLAGS or CPPFLAGS in the Makefile but include it the cc commands to let the user override our settings. --- diff --git a/Makefile b/Makefile index 31c2102..f7e19fb 100644 --- a/Makefile +++ b/Makefile @@ -95,13 +95,16 @@ lsg_objs := lopsubgen.o lsg.o lopsubgen.lsg.o lopsub.o version.o liblopsub_objs := config_file.o lopsub.o version.o lopsubex_objs := lopsubex.o lopsubex.lsg.o $(liblopsub_objs) +LLS_CFLAGS := -g -fPIC +STRICT_CFLAGS := -Wall + $(lsg_objs) $(liblopsub_objs) $(lopsubex_objs): %.o: %.c lopsubgen.o config_file.o: - $(CC) -g -c -fPIC -o $@ ${@:.o=.c} + $(CC) $(CPPFLAGS) $(LLS_CFLAGS) $(CFLAGS) -c -o $@ ${@:.o=.c} lsg1.o: lsg.c lsg.h - $(CC) -g -DSTAGE1 -Wall -c $< -o $@ + $(CC) $(CPPFLAGS) $(LLS_CFLAGS) $(STRICT_CFLAGS) $(CFLAGS) -DSTAGE1 -c -o $@ $< %.o: %.c - $(CC) -Wall -I. -g -c -fPIC -o $@ $< + $(CC) -I. $(CPPFLAGS) $(LLS_CFLAGS) $(STRICT_CFLAGS) $(CFLAGS) -c -o $@ $< # linking lopsubgen-stage1: $(lsg1_objs)