]> Sergey Matveev's repositories - nnn.git/commitdiff
Allow custom CFLAGS and CPPFLAGS in Makefile
authorZhiming Wang <zmwangx@gmail.com>
Mon, 3 Apr 2017 18:50:21 +0000 (14:50 -0400)
committerZhiming Wang <zmwangx@gmail.com>
Mon, 3 Apr 2017 18:50:21 +0000 (14:50 -0400)
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.

Makefile

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