forked from dgud/wings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
140 lines (109 loc) · 2.9 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
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
136
137
138
139
140
#
# Makefile --
#
# Top-level Makefile for building Wings 3D.
#
# Coepyright (c) 2001-2011 Bjorn Gustavsson
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
include erl.mk
# Check if OpenCL package is as external dependency
CL_PATH = $(shell $(ERL) -noshell -eval 'erlang:display(code:which(cl))' -s erlang halt)
ifneq (,$(findstring non_existing, $(CL_PATH)))
DEPS=cl
endif
DEPS += libigl eigen
SUBDIRS=c_src intl_tools src e3d plugins_src icons
#
# Normal build targets
#
opt debug clean:
$(MAKE) TYPE=$@ common
common: $(SUBDIRS) deps_result
.PHONY: opt debug clean $(SUBDIRS) deps_result
$(SUBDIRS):
$(MAKE) --directory=$@ $(TYPE)
#
# Build installer for Windows.
#
.PHONY: win32
win32: opt lang
(cd win32; $(MAKE))
escript tools/release
#
# Build a package for MacOS X.
#
.PHONY: macosx
macosx: opt lang
escript tools/release
#
# Build package for Unix.
#
.PHONY: unix
unix: opt lang
escript tools/release
#
# Generate language files
#
lang: intl_tools src plugins_src
(cd src; $(MAKE) lang)
(cd plugins_src; $(MAKE) lang)
$(ESCRIPT) tools/verify_language_files .
#
# Build the source distribution.
#
.PHONY: .FORCE-WINGS-VERSION-FILE
vsn.mk: .FORCE-WINGS-VERSION-FILE
@./WINGS-VERSION-GEN
-include vsn.mk
WINGS_TARNAME=wings-$(WINGS_VSN)
.PHONY: dist
dist:
git archive --format=tar \
--prefix=$(WINGS_TARNAME)/ HEAD^{tree} > $(WINGS_TARNAME).tar
@mkdir -p $(WINGS_TARNAME)
@echo $(WINGS_VSN) > $(WINGS_TARNAME)/version
tar rf $(WINGS_TARNAME).tar $(WINGS_TARNAME)/version
@rm -r $(WINGS_TARNAME)
bzip2 -f -9 $(WINGS_TARNAME).tar
#
# Build helper
# Makes it possible to see 'OpenCL' build problems
deps_result: $(SUBDIRS)
@cat _deps/build_log 2> /dev/null || true
# Internal dependencies
# Some not needed, added to disable parallel builds of erlang dirs
# which causes performance loss if an erlang build server is used
c_src: $(DEPS)
src: intl_tools e3d
plugins_src: intl_tools src
icons: e3d plugins_src
lang: opt
#
# External Dependencies
#
CL_REPO = https://github.com/tonyrog/cl.git
IGL_REPO = https://github.com/dgud/libigl.git
EIGEN_REPO = https://github.com/eigenteam/eigen-git-mirror.git
CL_VER=cl-1.2.4
IGL_VER=master
EIGEN_VER=3.3.7
# see libigl/cmake/LibiglDownloadExternal.cmake for eigen version
GIT_FLAGS = -c advice.detachedHead=false clone --depth 1
.PHONY: cl igl eigen
# cl (erl wrapper library) not in path try to download and build it
cl: _deps/cl
@(cd _deps/cl; rebar3 compile > ../build_log 2>&1 && rm ../build_log) \
|| echo ***Warning*** OpenCL not useable >> _deps/build_log
_deps/cl:
git $(GIT_FLAGS) -b $(CL_VER) $(CL_REPO) _deps/cl
# libigl have many useful function
libigl: _deps/libigl
_deps/libigl:
git $(GIT_FLAGS) -b $(IGL_VER) $(IGL_REPO) _deps/libigl
# eigen needed by libigl
eigen: _deps/eigen
_deps/eigen:
git $(GIT_FLAGS) -b $(EIGEN_VER) $(EIGEN_REPO) _deps/eigen