From df714376c5594cba604a7f879eca34b0c7e0abff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Sun, 22 Oct 2017 12:23:41 +0200 Subject: [PATCH] Always take {C,CPP,LD}FLAGS from environment Our own default values go into accompanying macros prefixed with DEF_. --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 196b8ff..0b428bc 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = git-20171019 +VERSION = git-20171022 srcdir = . VPATH = $(srcdir) @@ -6,10 +6,9 @@ VPATH = $(srcdir) PREFIX = /usr/local MANPREFIX = $(PREFIX)/share/man -CC ?= cc -CFLAGS += -std=c99 -Wall -pedantic -CPPFLAGS += -I/usr/include/freetype2 -LDFLAGS += +CC = cc +DEF_CFLAGS = -std=c99 -Wall -pedantic +DEF_CPPFLAGS = -I/usr/include/freetype2 # autoreload backend: inotify/nop AUTORELOAD = inotify @@ -20,9 +19,10 @@ HAVE_GIFLIB = 1 # enable features requiring libexif (-lexif) HAVE_LIBEXIF = 1 +ALL_CFLAGS = $(DEF_CFLAGS) $(CFLAGS) REQ_CPPFLAGS = -I. -D_XOPEN_SOURCE=700 -DVERSION=\"$(VERSION)\" \ -DHAVE_GIFLIB=$(HAVE_GIFLIB) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF) -ALL_CPPFLAGS = $(REQ_CPPFLAGS) $(CPPFLAGS) +ALL_CPPFLAGS = $(REQ_CPPFLAGS) $(DEF_CPPFLAGS) $(CPPFLAGS) LIB_EXIF_0 = LIB_EXIF_1 = -lexif @@ -42,16 +42,16 @@ all: sxiv .SUFFIXES: .c .o $(V).SILENT: -sxiv: $(OBJS) +sxiv: $(OBJS) @echo "LINK $@" - $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LDLIBS) + $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJS) $(LDLIBS) $(OBJS): Makefile sxiv.h commands.lst config.h window.o: icon/data.h .c.o: @echo "CC $@" - $(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c -o $@ $< + $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $< config.h: @echo "GEN $@"