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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
|
# @configure_input@
ARCH = unix
POLL = poll
ASYGLVERSION = @ASYGLVERSION@
GCVERSION = @GCVERSION@
GC = gc-$(GCVERSION)
LIBATOMIC = libatomic_ops-@ATOMICVERSION@
GCOPTIONS = @GCOPTIONS@
GCLIB = @GCLIB@
GCPPLIB = @GCPPLIB@
GCLIBS = $(GCPPLIB) $(GCLIB)
LFLAGS = @LDFLAGS@ -LLspCpp
LIBS = $(LFLAGS) @PTHREAD_LIBS@ @GLEW@ @LIBS@ $(GCLIBS) @LSPLIBS@
DOSLIBS = $(subst -lncurses, -ltermcap, $(LIBS)) -lwolfssl -lgdi32 -lwinmm -s -static
PERL ?= perl
PYTHON ?= python3
BISON ?= bison
PYRCC ?= pyrcc5
PYUIC ?= pyuic5
# Libraries needed to make asymptote.so.
# We have to remove OpenGL, threading, GC, etc from this.
SHAREDLIBS = $(filter-out -lglut -GL -pthread $(GCLIBS), $(LIBS))
vpath %.cc prc
vpath %.ui GUI/windows
vpath %.py GUI/pyUIClass
CAMP = camperror path drawpath drawlabel picture psfile texfile util settings \
guide flatguide knot drawfill path3 drawpath3 drawsurface \
beziercurve bezierpatch pen pipestream
RUNTIME_FILES = runtime runbacktrace runpicture runlabel runhistory runarray \
runfile runsystem runpair runtriple runpath runpath3d runstring \
runmath
# Files to be scanned for pre-translated symbols defined by SYM(name).
SYMBOL_FILES = types builtin gsl $(RUNTIME_FILES)
PRC = PRCbitStream oPRCFile PRCdouble writePRC
COREFILES = $(CAMP) $(SYMBOL_FILES) env genv stm dec errormsg \
callable name symbol entry exp newexp stack camp.tab lex.yy \
access virtualfieldaccess absyn record interact fileio \
fftw++asy simpson coder coenv impdatum \
@getopt@ locate parser program application varinit fundec refaccess \
envcompleter process constructor array Delaunay predicates \
$(PRC) glrender tr shaders jsfile v3dfile tinyexr EXRFiles GLTextures \
lspserv symbolmaps
FILES = $(COREFILES) main
SYMBOLSH = opsymbols.h allsymbols.h $(SYMBOL_FILES:=.symbols.h)
UIFILES = $(wildcard GUI/windows/*.ui)
PYFILES = $(wildcard GUI/pyUIClass/*.py) GUI/icons_rc.py
GENERATEDENUMS=v3dtypes v3dheadertypes
ASYGENERATEDENUMS=$(addprefix base/,$(GENERATEDENUMS:=.asy))
PYGENERATEDENUMS=$(GENERATEDENUMS:=.py)
DIST = camp.tab.h camp.tab.cc lex.yy.cc runtime.cc keywords.cc \
asy-keywords.el $(RUNTIME_FILES:=.cc) $(RUNTIME_FILES:=.h) asy.list \
$(SYMBOLSH) $(PYFILES) $(GENERATEDENUMS:=.h) $(ASYGENERATEDENUMS)
NAME = asy
XNAME = x$(NAME)
CLEAN = camp.output base/version.asy doc/version.texi \
GUI/xasyVersion.py GUI/icons_rc.py $(XNAME) doc/asy-latex.pdf \
$(SYMBOLSH)
EXTRA = asy-mode.el asy-init.el asy.vim asy_filetype.vim asy-kate.sh \
asymptote.py reload.js nopapersize.ps
EXEXTRA = piicon.png 100d.pdb1 *.views *.dat *.bib
DOCEXTRA = *.asy *.csv *.dat latexusage.tex externalprc.tex pixel.pdf
KEYWORDS = base $(ASYMPTOTE_SITEDIR)
LATEXFILES = asymptote.sty asycolors.sty latexmkrc
CONTEXTFILES = colo-asy.tex
ASY = ./asy -dir base -config "" -render=0
DEFS = @DEFS@ @OPTIONS@ @PTHREAD_CFLAGS@ -DFFTWPP_SINGLE_THREAD -Wall
CFLAGS = @CFLAGS@
OPTS = $(DEFS) @CPPFLAGS@ @CXXFLAGS@ $(CFLAGS) -ILspCpp -ILspCpp/LibLsp/JsonRpc
GLEWOPTS = $(DEFS) @CPPFLAGS@ $(CFLAGS) -DGLEW_NO_GLU -DGLEW_BUILD -O1 -fPIC
# Options for compiling the object files for the shared library.
# gc has to be configured with the option --disable-threads in order to make a
# shared library that doesn't seg fault. For now, just disable gc in the
# shared library.
SHAREDOPTS = $(filter-out -DUSEGC, $(OPTS)) -fPIC -DFOR_SHARED
CXX = @CXX@
CC = @CC@
MAKEDEPEND = $(OPTS) -O0 -M -MG -DDEPEND
LEX = @LEX@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
bindir = $(DESTDIR)@bindir@
mandir = $(DESTDIR)@mandir@
infodir = $(DESTDIR)@infodir@
datadir = $(DESTDIR)@datadir@
asydir = $(datadir)/asymptote
GUIdir = $(asydir)/GUI
shaderdir = $(asydir)/shaders
webgldir = $(asydir)/webgl
docdir = $(DESTDIR)@docdir@
exampledir = $(docdir)/examples
animationsdir = $(exampledir)/animations
latexdir = $(DESTDIR)@latexdir@
contextdir = $(DESTDIR)@contextdir@
INSTALL = @INSTALL@
REVISION = "const char *REVISION="
last = $(shell head -1 revision.cc | sed -e 's/.*\"\(.*\)\";/\1/')
usinggit = $(shell if test -d ".git"; then echo yes; fi)
ifeq ($(usinggit),yes)
revision = $(shell LC_ALL="C" git describe --long | \
sed -e 's/git-\([0-9]*\)-g.*/-\1/' | sed -e 's/-0-g.*//')
else
revision = @VERSION@
endif
export prefix docdir exampledir mandir infodir INSTALL MAKE DESTDIR TEXI2DVI
asy: version glew.o @LSPLIB@
if test -n "$(MSDOS)"; then \
$(CXX) $(OPTS) -o $(NAME) $(FILES:=.o) revision.o asy.o $(DOSLIBS); \
else \
ln -sf GUI/xasy.py $(XNAME); \
$(CXX) $(OPTS) -o $(NAME) $(FILES:=.o) revision.o $(LIBS); \
fi
version: $(GCLIB) $(FILES:=.o) $(notdir $(UIFILES:.ui=.py)) GUI/icons_rc.py $(ASYGENERATEDENUMS) $(PYGENERATEDENUMS)
if test ! -s revision.cc || test "$(revision)" != "$(last)"; then \
echo $(REVISION)\"$(revision)\"\; > revision.cc; \
echo const char *AsyGLVersion=\"$(ASYGLVERSION)\"\; >> revision.cc; \
if test ! -e base/webgl/asygl.js; then \
cp base/webgl/asygl-$(ASYGLVERSION).js base/webgl/asygl.js; \
fi \
fi
$(CXX) $(OPTS) -o revision.o -c revision.cc;
echo string VERSION=\"$(revision)\"\; > base/version.asy
echo @set VERSION $(revision) > doc/version.texi
echo @set Datadir @datadir@ >> doc/version.texi
echo @set Docdir @docdir@ >> doc/version.texi
echo "#!/usr/bin/env python3" > GUI/xasyVersion.py
echo xasyVersion = \"$(revision)\" >> GUI/xasyVersion.py
if test -n "$(MSDOS)"; then \
cat asy.rc | sed -e "s/ASYMPTOTE_VERSION/$(revision)/" | \
windres -o asy.o; \
fi
asymptote.so: $(COREFILES:=.pic.o) glew.o
$(CXX) $(OPTS) -shared -o asymptote.so revision.o $(COREFILES:=.pic.o) $(SHAREDLIBS)
liblspcpp.a:
cd LspCpp && $(MAKE) CPPFLAGS="@OPTIONS@"
all: asy sty man faq asy-keywords.el
$(GCLIB): $(GC).tar.gz
gunzip -c $(GC).tar.gz > $(GC).tar
tar -xf $(GC).tar
rm -f $(GC).tar
if test -r $(LIBATOMIC).tar.gz; then \
gunzip -c $(LIBATOMIC).tar.gz > $(LIBATOMIC).tar; \
tar -xf $(LIBATOMIC).tar; \
rm -f $(LIBATOMIC).tar; \
mv $(LIBATOMIC) $(GC)/libatomic_ops; \
fi
if test "$(GC)" = "gc-7.0"; then \
cd $(GC)/include/private && \
patch < ../../../patches/gc-7.0nomem.patch; \
fi
if test "$(GC)" = "gc-7.2b"; then \
mv gc-7.2 gc-7.2b; \
fi
if test "$(GC)" = "gc-7.2c"; then \
mv gc-7.2 gc-7.2c; \
fi
if test "$(GC)" = "gc-7.2d"; then \
mv gc-7.2 gc-7.2d; \
fi
cd $(GC) && \
./configure CC="$(CC)" CXX="$(CXX)" $(GCOPTIONS); \
$(MAKE) check
$(GCPPLIB): $(GCLIB)
sty:
cd doc && $(MAKE) asy-latex.pdf
dvi: asy sty
cd doc && $(MAKE) dvi
html: asy sty
cd doc && $(MAKE) doc
man: asy sty
cd doc && $(MAKE) man
faq: asy sty
cd doc && $(MAKE) faq
$(RUNTIME_FILES:=.cc): %.cc: runtime.pl opsymbols.h runtimebase.in %.in
$(PERL) ./runtime.pl $(@:.cc=)
$(SYMBOL_FILES:=.symbols.h): %.symbols.h: findsym.pl %.cc
$(CXX) -E -DNOSYM $(OPTS) $(@:.symbols.h=.cc) | \
$(PERL) ./findsym.pl $@ -
$(SYMBOL_FILES:=.o): %.o: %.symbols.h
allsymbols.h: findsym.pl $(SYMBOL_FILES:=.cc)
$(CXX) -E -DNOSYM $(OPTS) $(SYMBOL_FILES:=.cc) | \
$(PERL) ./findsym.pl $@ -
symbol.o: $(SYMBOLSH)
GUI/icons_rc.py: GUI/res/icons.qrc
-$(PYRCC) GUI/res/icons.qrc -o GUI/icons_rc.py
camp.tab.cc: camp.y
$(BISON) -dvt -b camp camp.y && mv camp.tab.c camp.tab.cc
camp.tab.h: camp.tab.cc
lex.yy.cc: camp.l
$(LEX) -d -olex.yy.cc camp.l
lex.yy.d: $(GCLIB) lex.yy.cc camp.tab.h
keywords.cc: keywords.pl camp.l process.cc
$(PERL) ./keywords.pl
opsymbols.h: opsymbols.pl camp.l
$(PERL) ./opsymbols.pl
envcompleter.d: keywords.cc
asy-keywords.el: asy
@echo Creating $@;
$(ASY) -l > asy.list
ls $(addsuffix /*.asy,$(KEYWORDS)) | grep -v plain\* | \
grep -v three_\* | grep -v featpost3D | xargs $(ASY) -l >> asy.list
$(PERL) ./asy-list.pl asy.list $(revision)
install-notexhash: asy-keywords.el install-asy install-man
install: install-notexhash install-texhash
install-all: install install-html
install-texhash: install-asy
-if test -z "$(DESTDIR)"; then \
texhash; \
fi
install-asy: asy sty
${INSTALL} -d $(bindir) $(asydir) $(exampledir) $(animationsdir)
${INSTALL} -d $(GUIdir) $(GUIdir)/pyUIClass $(GUIdir)/configs \
$(GUIdir)/res $(GUIdir)/res/icons $(shaderdir) \
$(webgldir)
-${INSTALL} -d $(latexdir)
-${INSTALL} -d $(contextdir)
${INSTALL} -p -m 755 $(NAME) $(bindir)
${INSTALL} -p -m 644 base/*.asy $(addprefix base/,$(EXTRA)) \
asy-keywords.el $(asydir)
${INSTALL} -p -m 755 GUI/*.py $(GUIdir)
${INSTALL} -p -m 755 base/shaders/*.glsl $(shaderdir)
${INSTALL} -p -m 644 base/webgl/asygl.js \
$(webgldir)
-${INSTALL} -p -m 644 GUI/pyUIClass/*.py $(GUIdir)/pyUIClass
${INSTALL} -p -m 644 GUI/configs/*.cson $(GUIdir)/configs
${INSTALL} -p -m 644 GUI/res/icons.qrc $(GUIdir)/res
${INSTALL} -p -m 644 GUI/res/icons/*.svg $(GUIdir)/res/icons
ln -sf @datadir@/asymptote/GUI/xasy.py $(bindir)/$(XNAME)
${INSTALL} -p -m 644 examples/*.asy $(addprefix examples/,$(EXEXTRA)) \
doc/extra/*.asy $(addprefix doc/,$(DOCEXTRA)) $(exampledir)
${INSTALL} -p -m 644 examples/animations/*.asy \
examples/animations/inlinemovie.tex \
examples/animations/inlinemovie3.tex $(animationsdir)
-${INSTALL} -p -m 644 $(addprefix doc/,$(LATEXFILES)) $(latexdir)
-${INSTALL} -p -m 644 $(addprefix doc/,$(CONTEXTFILES)) $(contextdir)
install-html: html
cd doc && $(MAKE) install-all
install-man: man
cd doc && $(MAKE) install
install-prebuilt: install-asy
cd doc && $(MAKE) install-prebuilt
uninstall: uninstall-all
uninstall-all: uninstall-man uninstall-asy uninstall-docdir
uninstall-asy:
-cd $(animationsdir) && rm -f *.asy *.tex
-rmdir $(animationsdir)
-cd $(exampledir) && rm -f $(EXEXTRA) $(DOCEXTRA)
-rmdir $(exampledir)
-cd $(GUIdir) && rm -f *.py
-cd $(GUIdir)/pyUIClass && rm -f *.py
-rmdir $(GUIdir)/pyUIClass
-cd $(GUIdir)/configs && rm -f *.cson
-rmdir $(GUIdir)/configs
-cd $(GUIdir)/res/icons && rm -f *.svg
-rmdir $(GUIdir)/res/icons
-cd $(GUIdir)/res && rm -f icons.qrc
-rmdir $(GUIdir)/res
-rmdir $(GUIdir)
-cd $(shaderdir) && rm -f *.glsl
-rmdir $(shaderdir)
-cd $(webgldir) && rm -f *.html *.js
-rmdir $(webgldir)
-cd $(asydir) && rm -f asy-keywords.el *.asy $(EXTRA)
-rmdir $(asydir)
-cd $(latexdir) && rm -f $(LATEXFILES)
-rmdir $(latexdir)
-cd $(contextdir) && rm -f $(CONTEXTFILES)
-rmdir $(contextdir)
-cd $(bindir) && rm -f $(NAME) $(XNAME)
uninstall-man:
cd doc && $(MAKE) uninstall
uninstall-docdir:
-rmdir $(docdir)
clean: FORCE
-rm -f asy asymptote.so *.pic.o *.o *.d *mon.out $(CLEAN)
cd LspCpp && $(MAKE) clean
gc-clean: FORCE clean
-if test -d $(GC); then \
$(MAKE) -C $(GC) clean; \
fi
cleaner: FORCE clean
-if test -d $(GC); then \
rm -rf $(GC); \
fi
-rm -f Makefile config.h config.log config.status errors.temp
cd doc && $(MAKE) clean
cd tests && $(MAKE) distclean
distclean: FORCE cleaner
cd doc && $(MAKE) distclean
cleanest: FORCE maintainer-clean
maintainer-clean: FORCE distclean
-rm -f configure config.h.in $(DIST)
-rm -rf autom4te.cache
-rm -rf GUI/pyUIClass
test: asy FORCE
./wce
$(MAKE) -C tests
check: test
check-all: asy FORCE
./wce
$(MAKE) -C tests all
glew.o: glew.c GL/glew.h GL/glew.c config.h
$(CC) -I. $(GLEWOPTS) -o glew.o -c glew.c
.SUFFIXES: .c .cc .o .d .ui .py
%.o: %.cc $(GENERATEDENUMS:=.h)
$(CXX) $(OPTS) -o $@ -c $<
%.d: %.cc $(GENERATEDENUMS:=.h) $(GCLIB)
@echo Creating $@; \
rm -f $@; \
${CXX} $(MAKEDEPEND) $(MDOPTS) $< > $@.$$$$ 2>/dev/null && \
sed 's,\($*\)\.o[ :]*,\1.o \1.pic.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
%.d: %.c
@echo Creating $@; \
rm -f $@; \
${CC} $(MAKEDEPEND) $(MDOPTS) $< > $@.$$$$ 2>/dev/null && \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
%.py: %.ui
mkdir -p GUI/pyUIClass
-$(PYUIC) -o GUI/pyUIClass/$(notdir $@) $<
# Compile for the shared library. OpenGL must be disabled as it causes
# crashes inside a shared library.
%.pic.o: %.cc
$(CXX) $(SHAREDOPTS) -o $@ -c $<
# Generate V3D headers
%.h: %.csv generate_enums.py $(GENERATEDENUMS:=.csv)
$(PYTHON) generate_enums.py -language cxx -o $@ -i $< -name $(notdir $*) -xopt namespace=camp
base/%.asy: %.csv generate_enums.py $(GENERATEDENUMS:=.csv)
$(PYTHON) generate_enums.py -language asy -o $@ -i $< -name $(notdir $*)
%.py: %.csv generate_enums.py $(GENERATEDENUMS:=.csv)
$(PYTHON) generate_enums.py -language python -o $@ -i $< -name $(notdir $*)
ifeq (,$(findstring clean,${MAKECMDGOALS}))
-include $(FILES:=.d)
endif
FORCE:
configure: configure.ac
autoheader && autoconf
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck
|