diff mbox

[2/2] Small build system improvements.

Message ID 1437542484-23409-3-git-send-email-ahmed.taahir@gmail.com (mailing list archive)
State Not Applicable
Delegated to: Kalle Valo
Headers show

Commit Message

ahmed.taahir@gmail.com July 22, 2015, 5:21 a.m. UTC
From: Taahir Ahmed <ahmed.taahir@gmail.com>

Phony targets are properly declared.

User's CFLAGS are not clobbered with '-O2 -g' unless the user has set no
cflags.
---
 Makefile | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 4ce900c..b5aa8e3 100644
--- a/Makefile
+++ b/Makefile
@@ -29,17 +29,19 @@  RUNTIME_PUBKEY_DIR?=/etc/wireless-regdb/pubkeys
 # utils/key2pub.py.  Python 2.7 and 3.x are supported.
 BUILDTIME_PYTHON ?= python
 
-CFLAGS += -O2 -fpic
+CFLAGS ?= -O2 -g
+CFLAGS += -fPIC
 CFLAGS += -std=gnu99 -Wall -Werror -pedantic
-CFLAGS += -Wall -g
 LDLIBREG += -lreg
 LDLIBS += $(LDLIBREG)
 LDLIBS += -lm
 LIBREG += libreg.so
 LDFLAGS += -L ./
 
+.PHONY: all
 all: all_noverify verify
 
+.PHONY: all_noverify
 all_noverify: $(LIBREG) crda intersect regdbdump db2rd optimize
 
 ifeq ($(USE_OPENSSL),1)
@@ -122,11 +124,13 @@  $(LIBREG): regdb.h reglib.h reglib.c
 	$(NQ) '  CC  ' $@
 	$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -shared -Wl,-soname,$(LIBREG) $^
 
+.PHONY: install-libreg-headers
 install-libreg-headers:
 	$(NQ) '  INSTALL  libreg-headers'
 	$(Q)mkdir -p $(DESTDIR)/$(INCLUDE_DIR)
 	$(Q)cp *.h $(DESTDIR)/$(INCLUDE_DIR)/
 
+.PHONY: install-libreg
 install-libreg:
 	$(NQ) '  INSTALL  libreg'
 	$(Q)mkdir -p $(DESTDIR)/$(LIBDIR)
@@ -167,6 +171,7 @@  verify: $(REG_BIN) regdbdump
 	@$(NQ) ' GZIP' $<
 	$(Q)gzip < $< > $@
 
+.PHONY: install
 install: install-libreg install-libreg-headers crda crda.8.gz regdbdump.8.gz
 	$(NQ) '  INSTALL  crda'
 	$(Q)$(MKDIR) $(DESTDIR)/$(SBINDIR)
@@ -189,6 +194,7 @@  install: install-libreg install-libreg-headers crda crda.8.gz regdbdump.8.gz
 	$(NQ) '  INSTALL  regdbdump.8.gz'
 	$(Q)$(INSTALL) -m 644 -t $(DESTDIR)/$(MANDIR)/man8/ regdbdump.8.gz
 
+.PHONY: clean
 clean:
 	$(Q)rm -f $(LIBREG) crda regdbdump intersect db2rd optimize \
 		*.o *~ *.pyc keys-*.h *.gz \