From 7fca0bb95adc98cadd6a326fa29cd0e156867c5d Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Thu, 21 Jan 2016 12:12:28 +0100 Subject: [PATCH] changed _gnu-make/Makefile to compile with -std=c99 and use $(CXX) for linking C++ versions, fixes #3 --- _gnu-make/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/_gnu-make/Makefile b/_gnu-make/Makefile index fe32c26..ef782c7 100644 --- a/_gnu-make/Makefile +++ b/_gnu-make/Makefile @@ -30,7 +30,8 @@ buildir := $(realpath .)/build binsubdir := $(platform)-$(architecture) bindir := $(prefix)/bin/$(binsubdir) -CFLAGS := -O2 -g -Wall -pedantic -Werror +CFLAGS := -O2 -g -Wall -pedantic -Werror -std=c99 -D_XOPEN_SOURCE=500 +CXXFLAGS := -O2 -g -Wall -pedantic -Werror ifeq ($(platform),linux) override LDFLAGS := $(LDFLAGS) -ldl @@ -53,7 +54,7 @@ $(bindir)/executable: $(srcdir)/whereami.c $(srcdir)/whereami.h $(exampledir)/ex $(bindir)/executable-cpp: $(srcdir)/whereami.c $(srcdir)/whereami.h $(exampledir)/executable.c mkdir -p $(@D) - $(CC) -x c++ -o $@ -I $(srcdir) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -fpic $(filter-out %.h,$^) + $(CXX) -x c++ -o $@ -I $(srcdir) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fpic $(filter-out %.h,$^) $(if $(postbuild),$(postbuild) $@) .PHONY: build-library @@ -67,7 +68,7 @@ $(bindir)/library$(libsuffix): $(srcdir)/whereami.c $(srcdir)/whereami.h $(examp $(bindir)/library-cpp$(libsuffix): $(srcdir)/whereami.c $(srcdir)/whereami.h $(exampledir)/library.c mkdir -p $(@D) - $(CC) -x c++ -shared -o $@ -I $(srcdir) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -fpic $(filter-out %.h,$^) + $(CXX) -x c++ -shared -o $@ -I $(srcdir) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fpic $(filter-out %.h,$^) $(if $(postbuild),$(postbuild) $@) clean: