Allow custom CFLAGS and CPPFLAGS in Makefile

This is consistent with the fact that custom LDFLAGS are already allowed, and
for once, it makes warning options easier to control.

Also use automatic variables $@ and $^ consistently.
This commit is contained in:
Zhiming Wang 2017-04-03 14:50:21 -04:00
parent 754ea4d3ef
commit e758ff78e5
No known key found for this signature in database
GPG key ID: 5B58F95EC95965D8

View file

@ -3,9 +3,7 @@ VERSION = 0.6
PREFIX = /usr/local PREFIX = /usr/local
MANPREFIX = $(PREFIX)/man MANPREFIX = $(PREFIX)/man
#CPPFLAGS = -DDEBUG CFLAGS += -O3 -march=native
#CFLAGS = -g
CFLAGS = -O3 -march=native
LDLIBS = -lcurses LDLIBS = -lcurses
DISTFILES = nnn.c config.def.h nnn.1 Makefile README.md LICENSE DISTFILES = nnn.c config.def.h nnn.1 Makefile README.md LICENSE
@ -21,8 +19,8 @@ $(LOCALCONFIG): config.def.h
$(SRC): $(LOCALCONFIG) $(SRC): $(LOCALCONFIG)
$(BIN): $(SRC) $(BIN): $(SRC)
$(CC) $(CFLAGS) -o $@ $(SRC) $(LDFLAGS) $(LDLIBS) $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)
strip $(BIN) strip $@
install: all install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/bin