From 73d2280b56e07b3115c14deaa994114a462afd33 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 26 Apr 2021 00:56:16 +0200 Subject: [PATCH] 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. --- Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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) -- 2.30.2