Commit 082b6b4f authored by Mikaël Salson's avatar Mikaël Salson

Makefile: Improve management of dependencies

The library is now built in core, where we have the list of dependencies
(dep.mk). Before dep.mk was in algo/ but the files it was refering to were in
core/. Thus the dep.mk file was useless.
parent 48707cbc
CC=g++
OPTIM=-O2
CFLAGS=-W -Wall $(OPTIM) $(DEBUG) $(CONFIG)
CXXFLAGS=-W -Wall $(OPTIM) $(DEBUG) $(CONFIG)
LDFLAGS=-lm
EXEC=vidjil kmer kmer_count cut count detailed_affect
SRCCORE=$(wildcard core/*.cpp) $(wildcard core/*.h)
MAINCORE=$(wildcard *.cpp)
OBJCORE=$(SRCCORE:.cpp=.o)
LIBCORE=core.a
LIBCORE=core/vidjil.a
BINDIR=..
.PHONY: all core clean forcedep
v: vidjil
###
......@@ -42,39 +42,26 @@ debug:
make clean
make DEBUG="-ggdb"
$(EXEC): %: %.o $(LIBCORE)
$(CC) -o $(BINDIR)/$@ $^ $(LDFLAGS) $(CFLAGS)
core: $(LIBCORE)
$(LIBCORE): $(OBJCORE)
rm -f $(LIBCORE)
ar rc $@ $^
%.o: %.cpp %.h core/dynprog.h
$(CC) -o $@ -c $< $(CFLAGS)
%.o: %.cpp
$(CC) -o $@ -c $< $(CFLAGS)
$(EXEC): %: %.o
make -C core
$(CC) -o $(BINDIR)/$@ $^ $(LIBCORE) $(LDFLAGS) $(CXXFLAGS)
clean:
rm -f core/*.o *.o $(LIBCORE)
make -C core $@
cd $(BINDIR) ; rm -f $(EXEC)
make -C tests $@
forcedep:
g++ -M $(SRCCORE) $(MAINCORE) > dep.mk
g++ -M $(MAINCORE) > dep.mk
DEP=$(wildcard dep.mk)
ifeq (${DEP},)
$(shell g++ -M $(SRCCORE) $(MAINCORE) > dep.mk)
$(shell g++ -M $(MAINCORE) > dep.mk)
endif
include dep.mk
RELEASE_H = release.h
RELEASE_SOURCE = $(wildcard src/*.cpp) $(wildcard src/*.h) $(wildcard src/core/*.cpp) $(wildcard src/core/*.h)
RELEASE_FILES = $(RELEASE_SOURCE) src/Makefile germline/get-germline doc/README doc/LICENSE
......
CC=g++
OPTIM=-O2
CXXFLAGS=-W -Wall $(OPTIM)
SRCCORE=$(wildcard *.cpp)
OBJCORE=$(SRCCORE:.cpp=.o)
LIBCORE=vidjil.a
all: $(LIBCORE)
$(LIBCORE): $(OBJCORE)
ar rc $@ $^
clean:
rm -f $(OBJCORE) $(LIBCORE)
DEP=$(wildcard dep.mk)
ifeq (${DEP},)
$(shell g++ -M $(SRCCORE) > dep.mk)
endif
include dep.mk
CC=g++
CFLAGS=-W -Wall -g -O0
CXXFLAGS=-W -Wall -g -O0
INCLUDE=-I ..
LDFLAGS=
SRC= tests.cpp
EXEC=$(SRC:.cpp=)
OTHER_SRC=$(wildcard *.cpp)
LIB=../core.a
LIB=../core/vidjil.a
SHOULD=$(wildcard *.should_get)
SHOULD_LOG=$(SHOULD:.should_get=.log)
......@@ -27,16 +27,16 @@ should: core $(SHOULD_LOG)
./should-to-tap.sh $<
$(EXEC): % : %.o $(LIB)
$(CC) -o $@ $< $(LIB) $(LDFLAGS) $(CFLAGS)
$(CC) -o $@ $< $(LIB) $(LDFLAGS) $(CXXFLAGS)
../core.a: core
core:
make OPTIM="-O0 -g" -C .. core.a
make OPTIM="-O0 -g" -C ../core
%.o: %.cpp $(OTHER_SRC)
$(CC) -o $@ $(INCLUDE) -c $< $(CFLAGS)
$(CC) -o $@ $(INCLUDE) -c $< $(CXXFLAGS)
clean:
rm -f *.o $(EXEC) *.tap *.log
......
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