-
Notifications
You must be signed in to change notification settings - Fork 17
/
hob3l.mk
235 lines (184 loc) · 5.85 KB
/
hob3l.mk
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# -*- Mode: Makefile -*-
# Copyright (C) 2018-2024 by Henrik Theiling, License: GPLv3, see LICENSE file
package_name := hob3l
package_version := test
WITH_FONT :=
######################################################################
HOB3L := ./out/bin/hob3l.x
HOB3L_JS_COPY_AUX := pkgdatadir=./share sh ./script/hob3l-js-copy-aux.in
######################################################################
# header files
H_HOB3L := $(notdir $(wildcard include/hob3l/*.h))
######################################################################
# data files
SHARE_DATA := \
gl-matrix/common.js \
gl-matrix/mat4.js \
gl-matrix/vec3.js \
js-hob3l.local.html
######################################################################
# Main Functionality:
# libhob3l.a:
MOD_C.libhob3l.a := \
hob3l/internal.c \
hob3l/syn.c \
hob3l/syn-2scad.c \
hob3l/syn-msg.c \
hob3l/stl-parse.c \
hob3l/xml-parse.c \
hob3l/svg-parse.c \
hob3l/vec3-dict.c \
hob3l/scad.c \
hob3l/scad-2scad.c \
hob3l/csg3.c \
hob3l/csg3-2scad.c \
hob3l/csg2.c \
hob3l/csg2-tree.c \
hob3l/csg2-layer.c \
hob3l/csg2-bool.c \
hob3l/csg2-hull.c \
hob3l/csg2-2scad.c \
hob3l/csg2-2stl.c \
hob3l/csg2-2js.c \
hob3l/csg2-2ps.c \
hob3l/ps.c \
hob3l/gc.c
MOD_O.libhob3l.a := $(addprefix out/bin/,$(MOD_C.libhob3l.a:.c=.o))
MOD_D.libhob3l.a := $(addprefix out/bin/,$(MOD_C.libhob3l.a:.c=.d))
# Command Line Executable:
# hob3l.x:
MOD_C.hob3l.x := \
hob3l/main.c
MOD_O.hob3l.x := $(addprefix out/bin/,$(MOD_C.hob3l.x:.c=.o))
MOD_D.hob3l.x := $(addprefix out/bin/,$(MOD_C.hob3l.x:.c=.d))
LIB.hob3l.x := \
hob3l \
hob3lop \
hob3lmat \
hob3lbase
LIB_A.hob3l.x := $(addsuffix $(_LIB), $(addprefix out/bin/$(LIB_), $(LIB.hob3l.x)))
LIB_L.hob3l.x := $(addprefix -l, $(LIB.hob3l.x))
######################################################################
_ := $(shell mkdir -p out/test/hob3l)
_ := $(shell mkdir -p out/bin/hob3l)
_ := $(shell mkdir -p out/src/hob3l)
_ := $(shell mkdir -p out/share)
_ := $(shell mkdir -p out/speed)
-include out/bin/hob3l/*.d
bin: \
hob3l.x \
out/share/hob3l-js-copy-aux
hob3l.x: out/bin/hob3l.x
lib: $(LIB_A.hob3l.x)
data: $(addprefix out/,$(OUT_DATA))
sweep: sweep-hob3l
sweep-hob3l:
rm -f *~
rm -f *.bak
rm -f src/*~
rm -f src/*.bak
rm -f include/*~
rm -f include/*.bak
rm -f include/hob3l/*~
rm -f include/hob3l/*.bak
out/bin/$(LIB_)hob3l$(_LIB): $(MOD_O.libhob3l.a)
$(AR) cr [email protected]$(_LIB) $+
$(RANLIB) [email protected]$(_LIB)
mv [email protected]$(_LIB) $@
out/src/hob3l/%.inc: src/hob3l/%.sieve script/mksieve
./script/mksieve $< > [email protected]
mv [email protected] $@
out/bin/hob3l/scad.o: CPPFLAGS += -Iout/src/hob3l
out/bin/hob3l/scad.o: src/hob3l/scad.c \
out/src/hob3l/scad-cmd.inc
src/hob3l/scad-cmd.inc: src/hob3l/scad-cmd.sieve
out/bin/hob3l/gc.o: CPPFLAGS += -Iout/src/hob3l
out/bin/hob3l/gc.o: src/hob3l/gc.c \
out/src/hob3l/gc-color.inc
src/hob3l/gc-color.inc: src/hob3l/gc-color.sieve
out/bin/hob3l/svg-parse.o: CPPFLAGS += -Iout/src/hob3l
out/bin/hob3l/svg-parse.o: src/hob3l/svg-parse.c \
out/src/hob3l/svg-elem.inc
src/hob3l/svg-elem.inc: src/hob3l/svg-elem.sieve
out/bin/hob3l/main.o: CPPFLAGS += -Iout/src/hob3l
out/bin/hob3l.x: $(MOD_O.hob3l.x) $(LIB_A.hob3l.x)
$(CC) -o $@ $(MOD_O.hob3l.x) -Lout/bin $(LIB_L.hob3l.x) $(LIBS) -lm $(CFLAGS)
out/share/%: script/%.in
sed 's_@pkgdatadir@_$(pkgdatadir)_g' $< > [email protected]
mv [email protected] $@
out/bin/hob3l/main.o: src/hob3l/main.c out/src/hob3l/opt.inc
out/%.inc: %.switch $(srcdir)/script/mkswitch
$(srcdir)/script/mkswitch $< > [email protected]
mv [email protected] $@
.PHONY: markdown
markdown: \
out/html/README.html \
out/html/doc/scadformat.html \
out/html/doc/jsformat.html \
out/html/%.html: %.md
mkdir -p ./$(dir $@)
markdown $< > [email protected]
mv [email protected] $@
######################################################################
# installation, the usual ceremony.
installdirs-bin: installdirs-bin-hob3l
installdirs-bin-hob3l:
$(NORMAL_INSTALL)
$(MKINSTALLDIR) $(DESTDIR)$(bindir)
installdirs-data: installdirs-data-hob3l
installdirs-data-hob3l:
$(NORMAL_INSTALL)
$(MKINSTALLDIR) $(DESTDIR)$(pkgdatadir)
$(MKINSTALLDIR) $(DESTDIR)$(pkgdatadir)/gl-matrix
installdirs-lib: installdirs-lib-hob3l
installdirs-lib-hob3l:
$(NORMAL_INSTALL)
$(MKINSTALLDIR) $(DESTDIR)$(libdir)
installdirs-include: installdirs-include-hob3l
installdirs-include-hob3l:
$(NORMAL_INSTALL)
$(MKINSTALLDIR) $(DESTDIR)$(includedir)/hob3l
install-bin: install-bin-hob3l
install-bin-hob3l: installdirs-bin-hob3l
$(NORMAL_INSTALL)
$(INSTALL_BIN) \
out/bin/hob3l.x \
$(DESTDIR)$(bindir)/hob3l$(_EXE)
$(INSTALL_SCRIPT) \
out/share/hob3l-js-copy-aux \
$(DESTDIR)$(bindir)/hob3l-js-copy-aux
install-data: install-data-hob3l
install-data-hob3l: installdirs-data-hob3l
$(NORMAL_INSTALL)
for F in $(SHARE_DATA); do \
$(INSTALL_DATA) \
share/$$F \
$(DESTDIR)$(pkgdatadir)/$$F || exit 1; \
done
install-lib: install-lib-hob3l
install-lib-hob3l: installdirs-lib-hob3l
$(NORMAL_INSTALL)
$(INSTALL_DATA) out/bin/$(LIB_)hob3l$(_LIB) $(DESTDIR)$(libdir)/$(LIB_)hob3l$(_LIB)
install-include: install-include-hob3l
install-include-hob3l: installdirs-include-hob3l
$(NORMAL_INSTALL)
for H in $(H_HOB3L); do \
$(INSTALL_DATA) \
include/hob3l/$$H \
$(DESTDIR)$(includedir)/hob3l/$$H || exit 1; \
done
uninstall: uninstall-hob3l
uninstall-hob3l:
$(NORMAL_UNINSTALL)
$(UNINSTALL) $(DESTDIR)$(bindir)/hob3l$(EXE)
$(UNINSTALL) $(DESTDIR)$(bindir)/hob3l-js-copy-aux
$(UNINSTALL) $(DESTDIR)$(libdir)/$(LIB_)hob3l$(_LIB)
for H in $(H_HOB3L); do \
$(UNINSTALL) $(DESTDIR)$(includedir)/hob3l/$$H || exit 1; \
done
for F in $(SHARE_DATA); do \
$(UNINSTALL) $(DESTDIR)$(pkgdatadir)/$$F || exit 1; \
done
$(UNINSTALL_DIR) $(DESTDIR)$(includedir)/hob3l
$(UNINSTALL_DIR) $(DESTDIR)$(pkgdatadir)/gl-matrix
$(UNINSTALL_DIR) $(DESTDIR)$(pkgdatadir)