-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile_main
51 lines (36 loc) · 1.65 KB
/
Makefile_main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
include Makefile_config
TARGET_SOURCES := ${wildcard ${SRCDIR}/target/*.${SRCEXT}}
TARGETS := ${patsubst ${SRCDIR}/target/%.${SRCEXT},bin/%,${TARGET_SOURCES}}
TEST_SOURCES := ${wildcard ${SRCDIR}/tests/*.${SRCEXT}}
TESTS := ${patsubst ${SRCDIR}/tests/%.${SRCEXT},tests/%,${TEST_SOURCES}}
LIB_SOURCES := ${wildcard ${SRCDIR}/*.${SRCEXT}}
SOURCES := ${TARGET_SOURCES} ${TEST_SOURCES} ${LIB_SOURCES}
OBJECTS := ${patsubst ${SRCDIR}/%.${SRCEXT},${BUILDDIR}/%.o,${SOURCES}}
LIB_OBJECTS := ${patsubst ${SRCDIR}/%.${SRCEXT},${BUILDDIR}/%.o,${LIB_SOURCES}}
DEPENDS := ${patsubst ${SRCDIR}/%.${SRCEXT},${DEPDIR}/%.d,${SOURCES}}
target: ${TARGETS}
tests: ${TESTS}
all: target tests
${BINDIR}/% : ${BUILDDIR}/target/%.o ${LIB_OBJECTS}
${CC} ${LIB} $^ -o $@
${TESTSDIR}/% : ${BUILDDIR}/tests/%.o ${LIB_OBJECTS}
${CC} ${LIB} $^ -o $@
# mathlink related
mathlink/mathlink_template.c : mathlink/mathlink.tm
mprep $< -o $@
mathlink/mathlink_template.o : mathlink/mathlink_template.c
${CC} -c ${INC} ${CFLAGS} $< -o $@
mathlink/mathlink.o : mathlink/mathlink.cpp
${CC} -c ${INC} ${CFLAGS} $< -o $@
mathlink/mathlink : mathlink/mathlink.o mathlink/mathlink_template.o ${LIB_OBJECTS}
${CC} ${LIB} -L /home/lenard/Mathematica/10.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/ -lML64i4 -lpthread -ldl -lrt -luuid $^ -o $@
include ${DEPENDS}
${BUILDDIR}/%.o: ${SRCDIR}/%.${SRCEXT}
@mkdir -p `dirname $@` ;\
echo '${CC} -c ${INC} ${CFLAGS} $< -o $@' ;\
${CC} -c ${INC} ${CFLAGS} $< -o $@
include/version.h:
@echo "Creating version string..."; \
./create_version.sh 2> /dev/null
.PHONY: target tests all clean include/version.h
.SECONDARY: ${OBJECTS}