-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMakefile
More file actions
135 lines (100 loc) · 3.3 KB
/
Makefile
File metadata and controls
135 lines (100 loc) · 3.3 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
UNAME := $(shell uname -a)
OCEINCLUDE := $(shell if test -d /usr/local/include/oce; then echo "/usr/local/include/oce"; else echo ""; fi)
OPENCASCADEINC?=/usr/include/opencascade
OPENCASCADELIB?=/usr/lib/opencas
$(info Using OPENCASCADEINC as "${OPENCASCADEINC}")
$(info Using OPENCASCADELIB as "${OPENCASCADELIB}")
OCCLIBS=-lTKBRep -lTKG2d -lTKG3d -lTKGeomBase \
-lTKMath -lTKMesh -lTKSTEP -lTKSTEP209 \
-lTKSTEPAttr -lTKSTEPBase -lTKSTL -lTKXSBase -lTKernel \
ifeq "$(OCEINCLUDE)" ""
#CXX=gcc-4.4
CXXFLAGS += -I$(OPENCASCADEINC)
LDFLAGS += -L$(OPENCASCADELIB) -L/usr/lib ${OCCLIBS}
else
CXXFLAGS += -I/usr/local/include/oce -I/usr/include
LDFLAGS += -L/usr/local/lib -L/usr/lib ${OCCLIBS}
endif
# Required to compile on gentoo systems.
ifeq (gentoo,$(findstring gentoo,$(UNAME)))
CXXFLAGS = -I/usr/lib64/opencascade-6.5/ros/lin/inc
LDFLAGS = -L/usr/lib64/opencascade-6.5/ros/lin/lib64 ${OCCLIBS} -lGL
endif
# note that in ubuntu oneiric you will want to use gcc-4.4, since the
# opencascade libraries don't seem wotk work with 4.6 (because they
# were probably compiled with 4.4). on ifab.parc.com i just made 4.4
# the default.
#ifeq (Ubuntu,$(findstring Ubuntu,$(UNAME)))
#UBUNTUDISTRO := $(shell lsb_release -c)
#ifeq (oneiric,$(findstring oneiric,$(UBUNTUDISTRO)))
#CXX=g++-4.9
CXX=clang++ -std=c++11 -stdlib=libc++
#endif
#endif
#---------------------------------------------------------------------
#targets
#---------------------------------------------------------------------
ifeq "$(MAKECMDGOALS)" ""
CXXFLAGS += -ggdb3
endif
ifeq "$(MAKECMDGOALS)" "profile"
CXXFLAGS += -pg -ggdb3
LDFLAGS += -pg
endif
# Determine where we should output the object files.
OUTDIR = debug
ifeq "$(MAKECMDGOALS)" "debug"
OUTDIR = debug
CXXFLAGS += -ggdb3
endif
ifeq "$(MAKECMDGOALS)" "release"
OUTDIR = release
CXXFLAGS += -O3
endif
ifeq "$(MAKECMDGOALS)" "profile"
OUTDIR = profile
endif
# Add .d to Make's recognized suffixes.
SUFFIXES += .d
# We don't need to clean up when we're making these targets
NODEPS:=clean
#Find all the C++ files in the src/ directory
#SOURCES:=$(shell find * -name '*.cpp' | sort)
SOURCES:=$(shell ls *.cpp | sort)
OBJS:=$(patsubst %.cpp,%.o,$(SOURCES))
#These are the dependency files, which make will clean up after it creates them
DEPFILES:=$(patsubst %.cpp,%.d,$(SOURCES))
#Don't create dependencies when we're cleaning, for instance
ifeq (0, $(words $(findstring $(MAKECMDGOALS), $(NODEPS))))
-include $(DEPFILES)
endif
EXE = step2stl
ifeq (Darwin,$(findstring Darwin,$(UNAME)))
SHARED=-dynamiclib -flat_namespace
SHAREDLIB=step2stl.so.dylib
else
SHARED=-fPIC -shared
SHAREDLIB=step2stl.so
endif
all: $(EXE)
lib:
g++ -I/usr/local/include/oce -O3 -L/usr/local/lib $(OCCLIBS) -o $(SHAREDLIB) $(SHARED) lib.cpp
ffi-generate -f lib.hpp -l $(SHAREDLIB) -m step3stl -L /Library/Developer/CommandLineTools/usr/lib > node-ffi.js
debug: $(EXE)
release:$(EXE)
profile:$(EXE)
$(EXE): $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $(OBJS)
#This is the rule for creating the dependency files
deps/%.d: %.cpp
$(CXX) $(CXXFLAGS) -MM -MT '$(patsubst src/%,obj/%,$(patsubst %.cpp,%.o,$<))' $< > $@
#This rule does the compilation
obj/%.o: %.cpp %.d %.h
@$(MKDIR) $(dir $@)
$(CXX) $(CXXFLAGS) -o $@ -c $<
# make clean && svn update
clean:
bash -c 'rm -f *.o $(OBJS) $(EXE)'
install:
cp $(SHAREDLIB) /usr/local/lib
ldconfig