Separated configuration in makefile

This commit is contained in:
Guilhem Lavaux 2009-01-11 10:04:59 -06:00
parent e92e835b3b
commit 1b46dfa245
2 changed files with 14 additions and 10 deletions

View File

@ -1,11 +1,9 @@
SHLIBS= libCosmoTool.so SHLIBS= libCosmoTool.so
CXX=g++
CC=gcc
CXXFLAGS= -ggdb -O0
CFLAGS= -ggdb -O0
SOURCES= loadRamses.cpp yorick.cpp miniargs.cpp fortran.cpp interpolate.cpp load_data.cpp SOURCES= loadRamses.cpp yorick.cpp miniargs.cpp fortran.cpp interpolate.cpp load_data.cpp
LIBS= -lnetcdf_c++ -lnetcdf -lgsl -lgslcblas -lm LIBS= -lnetcdf_c++ -lnetcdf -lgsl -lgslcblas -lm
include config.mk
VPATH=../src VPATH=../src
all: $(SHLIBS) all: $(SHLIBS)
@ -14,7 +12,7 @@ libCosmoTool.so: loadRamses.o yorick.o miniargs.o fortran.o interpolate.o load_d
depend: $(SOURCES) depend: $(SOURCES)
@echo "[DEPENDS] $^" @echo "[DEPENDS] $^"
@$(CC) -M -MM $^ > .mydepends @$(CC) $(CPPFLAGS) -M -MM $^ > .mydepends
install: install:
@mkdir -p ../install/lib @mkdir -p ../install/lib
@ -32,22 +30,22 @@ clean:
@rm -f *.o @rm -f *.o
@rm -f $(PROGS) @rm -f $(PROGS)
.mydepends: depend .mydepends: depend Makefile config.mk
%.so: %.so:
@echo "[LINK SHARED] $@" @echo "[LINK SHARED] $@"
@$(CXX) -shared -o $@ $^ $(LIBS) @$(CXX) -shared -o $@ $^ $(LDFLAGS) $(LIBS)
%.prog: %.prog:
@echo "[L] $@" @echo "[L] $@"
@$(CXX) -o $@ $^ $(LIBS) @$(CXX) -o $@ $^ $(LDFLAGS) $(LIBS)
%.o: %.c %.o: %.c
@echo "[C] $< ..." @echo "[C] $< ..."
@$(CC) -c -fPIC -o $@ $< $(CFLAGS) @$(CC) -c -fPIC -o $@ $< $(CPPFLAGS) $(CFLAGS)
%.o: %.cpp %.o: %.cpp
@echo "[C++] $< ..." @echo "[C++] $< ..."
@$(CXX) -c -fPIC -o $@ $< $(CXXFLAGS) @$(CXX) -c -fPIC -o $@ $< $(CPPFLAGS) $(CXXFLAGS)
include .mydepends include .mydepends

6
lib/config.mk Normal file
View File

@ -0,0 +1,6 @@
CC=gcc
CXX=g++
CFLAGS=-ggdb -O0
CXXFLAGS=-ggdb -O0
LDFLAGS=
CPPFLAGS=