forked from MMonCa/MMonCa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.mmonca
61 lines (48 loc) · 1.79 KB
/
Makefile.mmonca
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
52
53
54
55
56
57
58
59
60
# ---------------------------------------------------------------------
# MMonCa compilation (no need to edit this file)
# Use Makefile.<target> in ./sysmakes for custom settings
#
# Author: Benoit Sklenard <[email protected]>
#
# October 15, 2014 (v1)
# December 20, 2014 (v2)
# February 11, 2015 (v2.1) : fix bug in dependencies
#
SHELL := /bin/bash
COLOR ?= yes
# Build rules and dependencies
SRC_INC := -I../src/
EXTRA_INC := $(SRC_INC) $(TCL_INC) $(BOOST_INC)
EXTRA_PATH := $(TCL_PATH) $(BOOST_PATH)
EXTRA_LIB := $(TCL_LIB) $(BOOST_LIB)
DIR := $(dir ../src/ ../src/kernel/ ../src/domains/ ../src/io/ ../src/lkmc/ ../src/okmc/ ../src/cascade/ ../src/electrostatics/ ../src/mechanics/ )
$(shell mkdir -p $(DIR:../src/%=%))
SRC_CC := $(sort $(wildcard $(addsuffix *.c,$(DIR))))
OBJ_CC := $(SRC_CC:../src/%.c=%.o)
DEP_CC := $(SRC_CC:../src/%.c=%.d)
SRC_CXX := $(sort $(wildcard $(addsuffix *.cpp,$(DIR))))
OBJ_CXX := $(SRC_CXX:../src/%.cpp=%.o)
DEP_CXX := $(SRC_CXX:../src/%.cpp=%.d)
OBJ := $(OBJ_CXX) $(OBJ_CC)
DEP := $(DEP_CXX) $(DEP_CC)
ifeq ($(COLOR),yes)
BUILD_OBJ_CC = \e[32mBuilding CC object $(@:../src/%=%) \e[0m
BUILD_OBJ_CXX = \e[32mBuilding CXX object $(@:../src/%=%) \e[0m
LINK_BINARY = \e[31;1mLinking CXX binary $(EXE) \e[0m
else
BUILD_OBJ_CC = Building CC object $(@:../src/%=%)
BUILD_OBJ_CXX = Building CXX object $(@:../src/%=%)
LINK_BINARY = Linking CXX binary $(EXE)
endif
# Link
all: $(OBJ)
@echo -e "$(LINK_BINARY)"
$(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o $(EXE)
# Compilation
$(OBJ_CC): %.o: ../src/%.c
@echo -e "$(BUILD_OBJ_CC)"
$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) $(DEPFLAGS) -c $< -o $@
$(OBJ_CXX): %.o: ../src/%.cpp
@echo -e "$(BUILD_OBJ_CXX)"
$(CXX) $(CXXFLAGS) $(SHFLAGS) $(EXTRA_INC) $(DEPFLAGS) -c $< -o $@
-include $(DEP)