diff --git a/Makefile b/Makefile index 969dfe7..5bedac1 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,24 @@ # ############################################################################## +#### Common compiler flags. +#### Flags given here are not intended to be overridden, but you can add more +#### by defining CFLAGS in the environment or on the 'make' command line. + +cc-option = $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null \ + 1>&2 2>/dev/null; then echo $(1); fi) + +override CFLAGS := \ + $(CFLAGS) -O2 -fomit-frame-pointer -std=c99 -I. -Icommon \ + -Wall -Wundef \ + $(call cc-option,-Wpedantic) \ + $(call cc-option,-Wdeclaration-after-statement) \ + $(call cc-option,-Wmissing-prototypes) \ + $(call cc-option,-Wstrict-prototypes) \ + $(call cc-option,-Wvla) + +############################################################################## + STATIC_LIB_SUFFIX := .a SHARED_LIB_SUFFIX := .so PROG_SUFFIX := @@ -31,28 +49,11 @@ ifneq ($(findstring -mingw,$(CC)),) PROG_CFLAGS := -static -municode PIC_REQUIRED := HARD_LINKS := + override CFLAGS := $(CFLAGS) $(call cc-option,-Wno-pedantic-ms-format) endif ############################################################################## -#### Common compiler flags. -#### Flags given here are not intended to be overridden, but you can add more -#### by defining CFLAGS in the environment or on the 'make' command line. - -cc-option = $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null \ - 1>&2 2>/dev/null; then echo $(1); fi) - -override CFLAGS := \ - $(CFLAGS) -O2 -fomit-frame-pointer -std=c99 -I. -Icommon \ - -Wall -Wundef \ - $(call cc-option,-Wpedantic) \ - $(call cc-option,-Wdeclaration-after-statement) \ - $(call cc-option,-Wmissing-prototypes) \ - $(call cc-option,-Wstrict-prototypes) \ - $(call cc-option,-Wvla) - -############################################################################## - #### Quiet make is enabled by default. Define V=1 to disable. ifneq ($(findstring s,$(MAKEFLAGS)),s)