-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
84 lines (75 loc) · 2.86 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
# This Makefile allows you to write your Javascript in separate files and then
# glue it together using the C preprocessor.
#
# (Makefiles use tab characters to introduce command lines.
# Make sure your editor preserves tabs when it saves Makefiles or it
# won't work. See http://ax.to/make for more info on debugging Makefiles.)
#
# Source Javascript files end in .js. These are built into a Javascript file
# with the suffix .jso ("Javascript object file") using this Makefile. It's a
# bad idea to edit .jso files as your edits will be destroyed the next time
# "make" runs.
#
# To prevent issues with including the same file multiple times, each .js that's
# included by another needs to have #ifndef/#define/#endifs guards around it,
# just like in C or C++ headers. Please see any of the .js files for examples.
#
# By convention, the top-level .js files, files that are never included by
# others, are only found in the js/ subdirectory, and all other files are found
# within the js/swirly/ subdirectory. The .jso files all end up in the top
# directory, with any Max files.
#
# For best results, I recommend the following directory structure.
#
# root/ # name this whatever you like.
# some-project.maxpat
# some-project.maxhelp
# some-project.js # I keep this as short as possible...
# some-project.jso # compiled JS
# js/
# swirly/ # all my JS
# # more of JS code goes in here or a subdirectory.
#
# but you can just dump all your stuff in one directory and this Makefile should
# just work.
PREPROCESS=gcc\
-C\
-D_COMPILE_DATE="'`date`'"\
-E\
-I. -I..\
-P\
-Wno-invalid-pp-token\
-iquote js\
-x c
# -E means stop after preprocessing.
# -P means don't generate line markers (which confuse Javascript).
# -C means not to discard comments.
# -x c means treat the file as C code.
# -Wno-invalid-pp-token means not to complain about Javascript strings
# using ' instead of ".
# -D_COMPILE_DATE="'`date`'" sets a preprocessor variable called _COMPILE_DATE
# to be the current date and time.
MAX4LIVE=~/Music/Ableton/User\ Library/Presets/MIDI\ Effects/Max\ MIDI\ Effect
all: \
nanolaser \
softstep \
delay-laser \
# lighter \
# crossmatrix \
# show \
# runner \
# lighter: max/lighter/lighter.jso
softstep: max/softstep/softstep.jso
nanolaser: max/nanolaser/nanolaser.jso
delay-laser: \
max/nanolaser/delay-laser.jso \
max/nanolaser/test-subboxes.jso
# Build .jso files from .js. The first entry in the list is the source file -
# the remaining entry is the list of all possible files it depends on. This
# means that when any JS file is changed, the whole thing is recompiled, which
# is perfectly reasonable as it's fast.
max/*/%.jso: js/max/%.js js/*/*.js js/*/*/*.js js/*/*/*/*.js js/*/*/*/*/*.js
$(PREPROCESS) $< -o "$@"
# Remove all the local .jso files.
clean:
rm -f ${MAX4LIVE}/*/*.jso Max/*/*.jso