Commit e7a6f4ec authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

build : intermediate objects

parent 050ca3b0
ALL: libmbfluid3.so libmbfluid2.so libscontact2.so libscontact3.so
CFLAGS=-Wno-unused-function -O3 -g -march=native -mtune=native -fPIC -std=gnu99 -Iscontact -Ihxt -Isrc
LDFLAGS=-shared -lm
CFLAGS:=-Wno-unused-function -O3 -g -march=native -mtune=native -fPIC -std=gnu99 -Iscontact -Ihxt -Isrc
LDFLAGS:=-shared -lm
FLUID_C=src/fluid_problem.c src/mesh.c src/mesh_find.c scontact/quadtree.c hxt/hxt_linear_system.c hxt/hxt_linear_system_lu.c hxt/hxt_message.c src/mbxml.c src/yxml.c src/fluid_problem_io.c
FLUID_H=src/tools.h src/fluid_problem.h hxt/hxt_linear_system.h src/mesh_find.h src/mesh.h scontact/quadtree.h scontact/vector.h
FLUID_C:=src/fluid_problem.c src/mesh.c src/mesh_find.c scontact/quadtree.c hxt/hxt_linear_system.c hxt/hxt_linear_system_lu.c hxt/hxt_message.c src/mbxml.c src/yxml.c src/fluid_problem_io.c
USE_PETSC=1
USE_PETSC:=1
ifeq ($(USE_PETSC),1)
FLUID_C += hxt/hxt_linear_system_petsc.c
CFLAGS += -I${PETSC_DIR}/${PETSC_ARCH}/include -I${PETSC_DIR}/include -I${PETSC_DIR}/include/petsc/mpiuni -DHXT_HAVE_PETSC
LDFLAGS += -L${PETSC_DIR}/${PETSC_ARCH}/lib -Wl,-rpath=${PETSC_DIR}/${PETSC_ARCH}/lib -lpetsc
endif
SCONTACT_C=scontact/quadtree.c scontact/scontact.c src/mbxml.c src/yxml.c
SCONTACT_H=scontact/quadtree.h scontact/scontact.h src/mbxml.h src/yxml.h
SCONTACT_C:=scontact/quadtree.c scontact/scontact.c src/mbxml.c src/yxml.c
FLUID_O2:=$(foreach f,$(FLUID_C),build2/$(f:.c=.o))
FLUID_O3:=$(foreach f,$(FLUID_C),build3/$(f:.c=.o))
SCONTACT_O2:=$(foreach f,$(SCONTACT_C),build2/$(f:.c=.o))
SCONTACT_O3:=$(foreach f,$(SCONTACT_C),build3/$(f:.c=.o))
build2/%.o : %.c
@mkdir -p "$(dir $@)"
$(CC) $(CFLAGS) -MT$@ -MMD -MP -MF build2/$*.Td $< -c -o $@ -DDIMENSION=2
@mv -f build2/$*.Td build2/$*.d && touch $@
libmbfluid2.so : ${FLUID_C} ${FLUID_H}
${CC} ${FLUID_C} -o $@ ${CFLAGS} ${LDFLAGS} -DDIMENSION=2
build3/%.o : %.c
@mkdir -p "$(dir $@)"
$(CC) $(CFLAGS) -MT$@ -MMD -MP -MF build3/$*.Td $< -c -o $@ -DDIMENSION=3
@mv -f build3/$*.Td build3/$*.d && touch $@
libmbfluid3.so : ${FLUID_C} ${FLUID_H}
${CC} ${FLUID_C} -o $@ ${CFLAGS} ${LDFLAGS} -DDIMENSION=3
libmbfluid2.so : ${FLUID_O2}
${CC} ${FLUID_O2} -o $@ ${LDFLAGS}
libscontact2.so : ${SCONTACT_C} ${SCONTACT_H}
${CC} ${SCONTACT_C} -o $@ ${CFLAGS} ${LDFLAGS} -DDIMENSION=2
libmbfluid3.so : ${FLUID_O3}
${CC} ${FLUID_O3} -o $@ ${LDFLAGS}
libscontact3.so : ${SCONTACT_C} ${SCONTACT_H}
${CC} ${SCONTACT_C} -o $@ ${CFLAGS} ${LDFLAGS} -DDIMENSION=3
libscontact2.so : ${SCONTACT_O2}
${CC} ${SCONTACT_O2} -o $@ ${LDFLAGS} -DDIMENSION=2
libscontact3.so : ${SCONTACT_O3}
${CC} ${SCONTACT_O3} -o $@ ${LDFLAGS} -DDIMENSION=3
clean :
${RM} *.so *.pyc -r __pycache__
${RM} *.so *.pyc -r __pycache__ build2 build3
DEPFILES:=$(patsubst %.c,build2/%.d,$(SCONTACT_C) $(FLUID_C)) $(patsubst %.c,build3/%.d,$(SCONTACT_C) $(FLUID_C))
include $(wildcard $(DEPFILES))
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