-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (32 loc) · 1.2 KB
/
Makefile
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
CC= g++
CXXFLAGS= -O3 -std=gnu++11 -I./include
BUILDDIR= build/make
unstruc_src = $(wildcard src/unstruc/*.cpp)
unstruc_filenames = $(basename $(notdir $(unstruc_src)))
unstruc_obj = $(addsuffix .o,$(addprefix $(BUILDDIR)/unstruc/,$(unstruc_filenames)))
tetmesh_src = $(wildcard src/tetmesh/*.cpp)
tetmesh_filenames = $(basename $(notdir $(tetmesh_src)))
tetmesh_obj = $(addsuffix .o,$(addprefix $(BUILDDIR)/tetmesh/,$(tetmesh_filenames)))
names= convert offset
executables= $(addprefix bin/unstruc-,$(names))
all: $(executables)
$(BUILDDIR)/unstruc/%.o : src/unstruc/%.cpp
@mkdir -p $(dir $@)
$(CC) $(CXXFLAGS) -I./include/unstruc $< -c -o $@
$(BUILDDIR)/lib/libunstruc.a : $(unstruc_obj)
@mkdir -p $(dir $@)
ar cr $@ $^
$(BUILDDIR)/tetmesh/%.o : src/tetmesh/%.cpp
@mkdir -p $(dir $@)
$(CC) $(CXXFLAGS) -I./include/tetmesh $< -c -o $@
$(BUILDDIR)/lib/libtetmesh.a : $(tetmesh_obj)
@mkdir -p $(dir $@)
ar cr $@ $^
bin/unstruc-offset : src/offset.cpp $(BUILDDIR)/lib/libunstruc.a $(BUILDDIR)/lib/libtetmesh.a
@mkdir -p bin
$(CC) $(CXXFLAGS) $^ -ltet -o $@
bin/unstruc-convert : src/convert.cpp $(BUILDDIR)/lib/libunstruc.a
@mkdir -p bin
$(CC) $(CXXFLAGS) $^ -o $@
clean:
rm -rf $(BUILDDIR) $(executables)