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
|
#
# FAUST compiler makefile
#
# start to determine the current platform
system := $(shell uname -s)
# normalizes MINGW versions
system := $(shell echo $(system) | grep MINGW > /dev/null && echo MINGW || echo $(system))
#===============================================================
# output directories
FAUSTDIR ?= faustdir
IOSDIR := iosdir
VERSION := 2.14.4
#===============================================================
# current generator and backends
CACHE = $(FAUSTDIR)/CMakeCache.txt
BCACHE = $(FAUSTDIR)/backends.txt
TCACHE = $(FAUSTDIR)/targets.txt
ifeq ($(system), MINGW)
GENERATOR ?= $(shell [ -f $(CACHE) ] && (grep CMAKE_GENERATOR:INTERNAL $(CACHE) | cut -d= -f2) || echo MSYS Makefiles)
NATIVEPACK = winpack
else
PREFIX ?= /usr/local
GENERATOR ?= $(shell [ -f $(CACHE) ] && (grep CMAKE_GENERATOR:INTERNAL $(CACHE) | cut -d= -f2) || echo Unix Makefiles)
endif
DESTDIR ?=
ifeq ($(system), MINGW)
NATIVEPACK = winpack
else ifeq ($(system), Darwin)
NATIVEPACK = macpack
else
NATIVEPACK = linuxpack
endif
DESTDIR ?=
.PHONY: faust install uninstall osc http package
MAKE ?= make
CMAKEOPT ?= -DCMAKE_BUILD_TYPE=Release
BUILDOPT ?= --config Release
#CMAKEOPT ?= -DCMAKE_BUILD_TYPE=Debug
#BUILDOPT ?= --config Debug
#===============================================================
# options
JOBS ?= -j 4
BACKENDS ?= $(shell [ -f $(BCACHE) ] && (grep BACKENDS $(BCACHE) | cut -d= -f2) || echo regular.cmake)
TARGETS ?= $(shell [ -f $(TCACHE) ] && (grep TARGETS $(TCACHE) | cut -d= -f2) || echo regular.cmake)
EMCC ?= emcc
#===============================================================
ifeq ($(GENERATOR), Xcode)
PROJ = $(FAUSTDIR)/faust.xcodeproj
JOBS ?= -jobs 4
endif
ifneq (,$(findstring Makefile, $(GENERATOR)))
PROJ = $(FAUSTDIR)/Makefile
endif
ifneq (,$(findstring "Visual Studio",$(GENERATOR)))
PROJ = $(FAUSTDIR)/faust.sln
JOBS ?= /maxcpucount:4
endif
#===============================================================
# main targets
all: $(PROJ)
cmake --build $(FAUSTDIR) $(BUILDOPT) -- $(JOBS)
clean:
cmake --build $(FAUSTDIR) --target clean
distclean:
rm -rf $(FAUSTDIR)
#===============================================================
help:
@echo "-------- FAUST compiler makefile --------"
@echo "Available targets are:"
@echo " 'all' (default) : builds the current targets (as defined by your targets setup)."
@echo
@echo "Targets that require specific setup (see TARGETS option):"
@echo " 'faust' : builds the Faust compiler."
@echo " 'osc' : builds the static Faust OSC libraries"
@echo " 'http' : builds the static Faust HTTPD libraries"
@echo " 'staticlib' : builds the libfaust library in static mode."
@echo " 'dynamiclib' : builds the libfaust library in dynamic mode."
@echo " 'oscdynamic' : builds the OSC library in dynamic mode."
@echo " 'httpdynamic': builds the HTTPD library in dynamic mode."
@echo
@echo " 'ioslib' : builds the libfaust static lib for iOS (makes use of the ios.cmake backend)"
@echo
@echo "Cleaning:"
@echo " 'clean' : removes the output of the 'all' targets"
@echo " 'distclean' : removes the 'FAUSTDIR' folder ($(FAUSTDIR)) but preserves the bin and lib folders"
@echo
@echo "Targets excluded from all:"
@echo " 'wasmlib' : builds the libfaust as a WebAssembly library"
@echo " 'asmjslib' : builds the libfaust as an ASMJS library"
@echo
@echo "Available options:"
@echo " FAUSTDIR=<dir> : the compilation directory. Default to '$(FAUSTDIR)'"
@echo " GENERATOR=<a cmake generator>: see cmake -h. Default to '$(GENERATOR)'"
@echo " CMAKEOPT=<cmake options> : pass options to cmake for project generation."
@echo " BUILDOPT=<cmake options> : pass options to cmake at build time (default to $(BUILDOPT))."
@echo " BACKENDS=<backends file> : see 'Backends' below"
@echo " TARGETS=<targets file> : see 'Targets' below"
@echo " JOBS : intended to set the number of tasks to run in parallel (default is $(JOBS))"
@echo
@echo "Backends:"
@echo " the FAUST backends currently included are described in the '$(BACKENDS)' file"
@echo " you can freely customize this file or use another file with the BACKENDS option"
@echo
@echo "Targets:"
@echo " the targets currently included are described in the '$(TARGETS)' file"
@echo " you can freely customize this file or use another file with the TARGETS option"
@echo
@echo "Utilities targets:"
@echo " 'cmake' : regenerate the project using the current config"
@echo " 'universal' : [MacOSX] set the universal binaries option ON."
@echo " 'native' : [MacOSX] set the universal binaries option OFF."
@echo " 'verbose' : turn the verbose makefile option ON."
@echo " 'silent' : turn the verbose makefile option OFF."
@echo " 'jsscripts' : to rebuild javascript resources (from architecture/httpdlib)."
@echo
@echo "Installation targets:"
@echo " 'install' : install faust to the target directory (default to $(DESTDIR)$(PREFIX)),"
@echo " 'uninstall' : remove previously installed files,"
@echo "Installation options:"
@echo " 'DESTDIR' : the destination directory,"
@echo " 'PREFIX' : the destination prefix,"
@echo " Note that when using a relative path, it is relative to FAUSTDIR ($(FAUSTDIR))"
@echo "------ see also the README.md file ------"
@echo
@echo "Packaging targets:"
@echo " 'package' : build a faust package for the current platform"
faust: $(PROJ)
cmake --build $(FAUSTDIR) --target faust $(BUILDOPT) -- $(JOBS)
osc: $(PROJ)
cmake --build $(FAUSTDIR) --target oscstatic $(BUILDOPT) -- $(JOBS)
oscdynamic: $(PROJ)
cmake --build $(FAUSTDIR) --target oscdynamic $(BUILDOPT) -- $(JOBS)
http: $(PROJ)
cmake --build $(FAUSTDIR) --target httpstatic $(BUILDOPT) -- $(JOBS)
httpdynamic: $(PROJ)
cmake --build $(FAUSTDIR) --target httpdynamic $(BUILDOPT) -- $(JOBS)
jsscripts:
make -C ../architecture/httpdlib/src/hexa
#===============================================================
# packaging
#===============================================================
PACK := package/Faust-$(VERSION)
package:
make $(NATIVEPACK)
winpack:
cd $(FAUSTDIR) && cmake -DUSE_LLVM_CONFIG=off -DPACK=on -C ../bakckends/most.cmake -C ../targets/most.cmake ..
make
cd $(FAUSTDIR) && cpack -G NSIS64
mv $(FAUSTDIR)/Faust-*.exe .
macpack: package/README.html
-[ -d $(PACK) ] && rm -rf $(PACK)
make cmake BACKENDs=all.cmake TARGETS=all.cmake
make install PREFIX=../$(PACK)/Faust-$(VERSION)
cp package/INSTALL.html $(PACK)
cp package/README.html $(PACK)
hdiutil create Faust-$(VERSION).dmg -fs HFS+ -srcfolder $(PACK) -format UDBZ -ov
linuxpack:
@echo Linux packaging not implemented.
package/README.html: ../README.md
echo "<!DOCTYPE html><html><xmp>" > package/README.html
cat ../README.md >> package/README.html
echo "</xmp>" >> package/README.html
echo "<script src=http://strapdownjs.com/v/0.2/strapdown.js></script>" >> package/README.html
echo "</html>" >> package/README.html
#===============================================================
# building universal binaries on macos
#===============================================================
universal: $(FAUSTDIR)
cd $(FAUSTDIR) && cmake -DUNIVERSAL=ON ..
native: $(FAUSTDIR)
cd $(FAUSTDIR) && cmake -DUNIVERSAL=OFF ..
#===============================================================
# building libraries
#===============================================================
staticlib: $(PROJ)
cmake --build $(FAUSTDIR) --target staticlib $(BUILDOPT) -- $(JOBS)
dynamiclib: $(PROJ)
cmake --build $(FAUSTDIR) --target dynamiclib $(BUILDOPT) -- $(JOBS)
#===============================================================
# building libfaust.a for ios
#===============================================================
ioslib: JOBS ?= -jobs 4
ioslib: $(IOSDIR) $(IOSDIR)/faust.xcodeproj
cmake --build $(IOSDIR) --target staticlib $(BUILDOPT) -- $(JOBS)
cmake --build $(IOSDIR) --target oscstatic $(BUILDOPT) -- $(JOBS)
$(IOSDIR)/faust.xcodeproj: CMakeLists.txt backends/ios.cmake
cd $(IOSDIR) && cmake -C ../backends/ios.cmake .. -DINCLUDE_STATIC=on -DINCLUDE_HTTP=off -G Xcode
#===============================================================
# misc targets
#===============================================================
$(FAUSTDIR):
mkdir $(FAUSTDIR)
$(IOSDIR):
mkdir $(IOSDIR)
$(PROJ):
$(MAKE) cmake
verbose: $(FAUSTDIR)
cd $(FAUSTDIR) && cmake -DCMAKE_VERBOSE_MAKEFILE=ON ..
silent: $(FAUSTDIR)
cd $(FAUSTDIR) && cmake -DCMAKE_VERBOSE_MAKEFILE=OFF ..
cmake: $(FAUSTDIR)
cd $(FAUSTDIR) && cmake -C ../backends/$(BACKENDS) -C ../targets/$(TARGETS) $(CMAKEOPT) -G '$(GENERATOR)' ..
@echo BACKENDS=$(BACKENDS) > $(BCACHE)
@echo TARGETS=$(TARGETS) > $(TCACHE)
reset: $(FAUSTDIR)
cd $(FAUSTDIR) && cmake -C ../backends/$(BACKENDS) $(CMAKEOPT) -DINCLUDE_STATIC=off -DINCLUDE_DYNAMIC=off -DINCLUDE_HTTP=on -DOSCDYNAMIC=off -DHTTPDYNAMIC=off ..
#===============================================================
# building faust with emscripten
#===============================================================
wasmlib: $(FAUSTDIR) $(FAUSTDIR)/Makefile
@$(MAKE) checkemcc
cmake --build $(FAUSTDIR) --target wasmlib $(BUILDOPT) -- $(JOBS)
asmjslib: $(FAUSTDIR) $(FAUSTDIR)/Makefile
@$(MAKE) checkemcc
cmake --build $(FAUSTDIR) --target asmjslib $(BUILDOPT) -- $(JOBS)
checkemcc:
@which $(EMCC) > /dev/null || (echo "### emcc must be available from your PATH."; false;)
#===============================================================
# faust install
#===============================================================
installLog := $(FAUSTDIR)/install_manifest.txt
install:
cd $(FAUSTDIR) && cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX)
cmake --build $(FAUSTDIR) --target install
uninstall: installedfiles = $(shell cat $(installLog))
uninstall: $(installLog)
rm -f $(installedfiles) $(installLog)
#===============================================================
undefined:
$(error System is undefined, not target available)
|