Always take {C,CPP,LD}FLAGS from environment

Our own default values go into accompanying macros prefixed with DEF_.
This commit is contained in:
Bert Münnich 2017-10-22 12:23:41 +02:00
parent 4d2fc0b889
commit df714376c5

View File

@ -1,4 +1,4 @@
VERSION = git-20171019 VERSION = git-20171022
srcdir = . srcdir = .
VPATH = $(srcdir) VPATH = $(srcdir)
@ -6,10 +6,9 @@ VPATH = $(srcdir)
PREFIX = /usr/local PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man MANPREFIX = $(PREFIX)/share/man
CC ?= cc CC = cc
CFLAGS += -std=c99 -Wall -pedantic DEF_CFLAGS = -std=c99 -Wall -pedantic
CPPFLAGS += -I/usr/include/freetype2 DEF_CPPFLAGS = -I/usr/include/freetype2
LDFLAGS +=
# autoreload backend: inotify/nop # autoreload backend: inotify/nop
AUTORELOAD = inotify AUTORELOAD = inotify
@ -20,9 +19,10 @@ HAVE_GIFLIB = 1
# enable features requiring libexif (-lexif) # enable features requiring libexif (-lexif)
HAVE_LIBEXIF = 1 HAVE_LIBEXIF = 1
ALL_CFLAGS = $(DEF_CFLAGS) $(CFLAGS)
REQ_CPPFLAGS = -I. -D_XOPEN_SOURCE=700 -DVERSION=\"$(VERSION)\" \ REQ_CPPFLAGS = -I. -D_XOPEN_SOURCE=700 -DVERSION=\"$(VERSION)\" \
-DHAVE_GIFLIB=$(HAVE_GIFLIB) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF) -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_0 =
LIB_EXIF_1 = -lexif LIB_EXIF_1 = -lexif
@ -42,16 +42,16 @@ all: sxiv
.SUFFIXES: .c .o .SUFFIXES: .c .o
$(V).SILENT: $(V).SILENT:
sxiv: $(OBJS) sxiv: $(OBJS)
@echo "LINK $@" @echo "LINK $@"
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LDLIBS) $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJS) $(LDLIBS)
$(OBJS): Makefile sxiv.h commands.lst config.h $(OBJS): Makefile sxiv.h commands.lst config.h
window.o: icon/data.h window.o: icon/data.h
.c.o: .c.o:
@echo "CC $@" @echo "CC $@"
$(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c -o $@ $< $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $<
config.h: config.h:
@echo "GEN $@" @echo "GEN $@"