Commit 344feb9c authored by Mathieu Giraud's avatar Mathieu Giraud

Makefile, */Makefile: do not override system-defined CXXFLAGS and LDFLAGS

Append some flags to CXXFLAGS
and use LDLIBS instead of LDFLAGS for -lm and -lz

See https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
parent aeddf091
CC=g++
OPTIM=-O2 -DNDEBUG $(COVERAGE)
CXXFLAGS=-W -Wall $(OPTIM) $(DEBUG) $(CONFIG)
OPTIM=-O2 -DNDEBUG $(COVERAGE) $(DEBUG)
override CXXFLAGS += -W -Wall $(OPTIM)
## inspired from http://stackoverflow.com/questions/399850/best-compiler-warning-level-for-c-c-compilers/401276
PARANOID= -Wall -Weffc++ -pedantic \
......@@ -23,7 +23,7 @@ PARANOID= -Wall -Weffc++ -pedantic \
-Wunused-function -Wunused-label -Wunused-parameter \
-Wunused-value -Wunused-variable -Wvariadic-macros \
-Wvolatile-register-var -Wwrite-strings
LDFLAGS=-lm -lz
LDLIBS=-lm -lz
EXEC=vidjil
MAINCORE=$(wildcard *.cpp)
LIBCORE=core/vidjil.a lib/lib.a
......@@ -69,7 +69,7 @@ cleanspaced:
align.cgi: cgi/align.o
mkdir -p $(CGIDIR)
make -C core OPTIM="$(OPTIM)"
$(CC) -o $(CGIDIR)/align.cgi cgi/align.o $(LIBCORE) $(LDFLAGS) $(CXXFLAGS)
$(CC) -o $(CGIDIR)/align.cgi cgi/align.o $(LIBCORE) $(LDFLAGS) $(LDLIBS) $(CXXFLAGS)
###
all: $(EXEC)
......@@ -81,7 +81,7 @@ debug:
$(EXEC): %: %.o
make -C core OPTIM="$(OPTIM)"
make -C lib OPTIM="$(OPTIM)"
$(CC) -o $(BINDIR)/$@ $^ $(LIBCORE) $(LDFLAGS) $(CXXFLAGS)
$(CC) -o $(BINDIR)/$@ $^ $(LIBCORE) $(LDFLAGS) $(LDLIBS) $(CXXFLAGS)
clean:
make -C core $@
......
CC=g++
OPTIM=-O2
CXXFLAGS=-W -Wall $(OPTIM)
override CXXFLAGS += -W -Wall $(OPTIM)
SRCCORE=$(wildcard *.cpp)
OBJCORE=$(SRCCORE:.cpp=.o)
LIBCORE=vidjil.a
......
CC=g++
OPTIM=-O2
CXXFLAGS=-W -Wall $(OPTIM)
OPTIM=-O2
override CXXFLAGS += -W -Wall $(OPTIM)
SRCCORE=$(wildcard *.cpp)
OBJCORE=$(SRCCORE:.cpp=.o)
LIBCORE=lib.a
......
CC=g++
CXXFLAGS=-W -Wall -g -O0 $(COVERAGE)
INCLUDE=-I ..
LDFLAGS=-lz
OPTIM=-g -O0 $(COVERAGE)
override CXXFLAGS += -W -Wall $(OPTIM)
LDLIBS=-lz
SRC= tests.cpp
EXEC=$(SRC:.cpp=)
OTHER_SRC=$(wildcard *.cpp)
......@@ -27,16 +28,16 @@ should: vidjil $(SHOULD_LOG)
./should-to-tap.sh $<
$(EXEC): % : %.o $(LIB)
$(CC) -o $@ $< $(LIB) $(LDFLAGS) $(CXXFLAGS)
$(CC) -o $@ $< $(LIB) $(LDLIBS) $(LDFLAGS) $(CXXFLAGS)
../core.a: core
vidjil:
make CXXFLAGS="$(CXXFLAGS)" -C ../
make -C ../
core:
make CXXFLAGS="$(CXXFLAGS)" -C ../core
make -C ../core
%.o: %.cpp $(OTHER_SRC)
$(CC) -o $@ $(INCLUDE) -c $< $(CXXFLAGS)
......
CC=g++
OPTIM=-O2 -DNDEBUG
CXXFLAGS=-W -Wall -I.. $(OPTIM) $(DEBUG) $(CONFIG)
LDFLAGS=-lm -lz
OPTIM=-O2
override CXXFLAGS += -W -Wall -I.. -I../lib/ $(OPTIM)
LDLIBS=-lm -lz
SRC=$(wildcard *.cpp)
EXEC=$(SRC:.cpp=)
LIBCORE=../core/vidjil.a ../lib/lib.a
......@@ -12,7 +12,7 @@ all: $(EXEC)
$(EXEC): %: %.o
make -C .. OPTIM="$(OPTIM)"
$(CC) -I .. -o $@ $^ $(LIBCORE) $(LDFLAGS) $(CXXFLAGS)
$(CC) -I .. -o $@ $^ $(LIBCORE)
clean:
rm -f $(EXEC)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment