csu/Makefile passes CFLAGS to csu/linux/Makefile via a recursive make invocation on the command-line. This causes CFLAGS of csu/linux/Makefile to be overwritten by the value supplied on the command-line. This patch is a hacky workaround to fix this. diff -upr pcc-libs-20230419.orig/csu/linux/Makefile pcc-libs-20230419/csu/linux/Makefile --- pcc-libs-20230419.orig/csu/linux/Makefile 2023-04-19 18:51:37.262841602 +0200 +++ pcc-libs-20230419/csu/linux/Makefile 2023-04-19 18:52:03.996245974 +0200 @@ -4,7 +4,7 @@ VERSION ?= 1.1.0 PCCLIBDIR ?= /usr/local/lib/pcc/$(TARGET)/$(VERSION)/lib SRCDIR ?= . -CFLAGS = -I$(SRCDIR)/$(MACH) -I$(SRCDIR) -Wall -Wstrict-prototypes -Wmissing-prototypes +CFLAGS_EXTRA = -I$(SRCDIR)/$(MACH) -I$(SRCDIR) -Wall -Wstrict-prototypes -Wmissing-prototypes #OBJS = crt0.o crt1.o gcrt1.o crti.o crtn.o crtbegin.o crtend.o \ # crtbeginS.o crtendS.o crtbeginT.o crtendT.o @@ -14,37 +14,37 @@ OBJS = crtbegin.o crtend.o crtbeginS.o c all: $(OBJS) crt0.o: $(MACH)/crt0.c - $(CC) -O2 $(CFLAGS) -c -o $@ $< + $(CC) -O2 $(CFLAGS) $(CFLAGS_EXTRA) -c -o $@ $< crt1.o: $(MACH)/crt0.c - $(CC) -O2 $(CFLAGS) -c -o $@ $< + $(CC) -O2 $(CFLAGS) $(CFLAGS_EXTRA) -c -o $@ $< gcrt1.o: $(MACH)/crt0.c - $(CC) -O2 -DPROFILE $(CFLAGS) -c -o $@ $< + $(CC) -O2 -DPROFILE $(CFLAGS) $(CFLAGS_EXTRA) -c -o $@ $< crti.o: $(MACH)/crti.c - $(CC) -O2 $(CFLAGS) -c -o $@ $< + $(CC) -O2 $(CFLAGS) $(CFLAGS_EXTRA) -c -o $@ $< crtn.o: $(MACH)/crtn.c - $(CC) -O2 $(CFLAGS) -c -o $@ $< + $(CC) -O2 $(CFLAGS) $(CFLAGS_EXTRA) -c -o $@ $< crtbegin.o: crtbegin.c - $(CC) -O2 $(CFLAGS) -c -o $@ $< + $(CC) -O2 $(CFLAGS) $(CFLAGS_EXTRA) -c -o $@ $< crtend.o: crtend.c - $(CC) -O2 $(CFLAGS) -c -o $@ $< + $(CC) -O2 $(CFLAGS) $(CFLAGS_EXTRA) -c -o $@ $< crtbeginS.o: crtbegin.c - $(CC) -O2 $(CFLAGS) -fpic -c -o $@ $< + $(CC) -O2 $(CFLAGS) $(CFLAGS_EXTRA) -fpic -c -o $@ $< crtendS.o: crtend.c - $(CC) -O2 $(CFLAGS) -fpic -c -o $@ $< + $(CC) -O2 $(CFLAGS) $(CFLAGS_EXTRA) -fpic -c -o $@ $< crtbeginT.o: crtbegin.c - $(CC) -O2 $(CFLAGS) -c -o $@ $< + $(CC) -O2 $(CFLAGS) $(CFLAGS_EXTRA) -c -o $@ $< crtendT.o: crtend.c - $(CC) -O2 $(CFLAGS) -c -o $@ $< + $(CC) -O2 $(CFLAGS) $(CFLAGS_EXTRA) -c -o $@ $< install: mkdir -p ${DESTDIR}$(PCCLIBDIR)