Browse Source

Add ARCH_* to arch.mk

tags/v0.6.1
Andrew Belt 6 years ago
parent
commit
e4a7e7ddfe
5 changed files with 47 additions and 51 deletions
  1. +15
    -15
      Makefile
  2. +16
    -20
      arch.mk
  3. +3
    -3
      compile.mk
  4. +9
    -9
      dep/Makefile
  5. +4
    -4
      plugin.mk

+ 15
- 15
Makefile View File

@@ -18,7 +18,7 @@ STRIP ?= strip
SOURCES += dep/nanovg/src/nanovg.c SOURCES += dep/nanovg/src/nanovg.c
SOURCES += $(wildcard src/*.cpp src/*/*.cpp) SOURCES += $(wildcard src/*.cpp src/*/*.cpp)


ifeq ($(ARCH), mac)
ifdef ARCH_MAC
SOURCES += dep/osdialog/osdialog_mac.m SOURCES += dep/osdialog/osdialog_mac.m
CXXFLAGS += -stdlib=libc++ CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++ -lpthread -ldl \ LDFLAGS += -stdlib=libc++ -lpthread -ldl \
@@ -28,7 +28,7 @@ ifeq ($(ARCH), mac)
BUNDLE := dist/$(TARGET).app BUNDLE := dist/$(TARGET).app
endif endif


ifeq ($(ARCH), win)
ifdef ARCH_WIN
SOURCES += dep/osdialog/osdialog_win.c SOURCES += dep/osdialog/osdialog_win.c
LDFLAGS += -static \ LDFLAGS += -static \
-Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \ -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
@@ -38,7 +38,7 @@ ifeq ($(ARCH), win)
OBJECTS += Rack.res OBJECTS += Rack.res
endif endif


ifeq ($(ARCH), lin)
ifdef ARCH_LIN
SOURCES += dep/osdialog/osdialog_gtk2.c SOURCES += dep/osdialog/osdialog_gtk2.c
CFLAGS += $(shell pkg-config --cflags gtk+-2.0) CFLAGS += $(shell pkg-config --cflags gtk+-2.0)
LDFLAGS += -rdynamic \ LDFLAGS += -rdynamic \
@@ -61,25 +61,25 @@ run: $(TARGET)
./$< ./$<


debug: $(TARGET) debug: $(TARGET)
ifeq ($(ARCH), mac)
ifdef ARCH_MAC
lldb -ex run ./$< lldb -ex run ./$<
endif endif
ifeq ($(ARCH), win)
ifdef ARCH_WIN
gdb -ex run ./$< gdb -ex run ./$<
endif endif
ifeq ($(ARCH), lin)
ifdef ARCH_LIN
gdb -ex run ./$< gdb -ex run ./$<
endif endif


perf: $(TARGET) perf: $(TARGET)
ifeq ($(ARCH), lin)
ifdef ARCH_LIN
perf record --call-graph dwarf ./Rack perf record --call-graph dwarf ./Rack
endif endif


clean: clean:
rm -rfv $(TARGET) libRack.a Rack.res build dist rm -rfv $(TARGET) libRack.a Rack.res build dist


ifeq ($(ARCH), win)
ifdef ARCH_WIN
# For Windows resources # For Windows resources
%.res: %.rc %.res: %.rc
windres $^ -O coff -o $@ windres $^ -O coff -o $@
@@ -95,7 +95,7 @@ endif
# Rack distribution # Rack distribution
$(MAKE) -C plugins/Fundamental dist $(MAKE) -C plugins/Fundamental dist


ifeq ($(ARCH), mac)
ifdef ARCH_MAC
mkdir -p $(BUNDLE) mkdir -p $(BUNDLE)
mkdir -p $(BUNDLE)/Contents mkdir -p $(BUNDLE)/Contents
mkdir -p $(BUNDLE)/Contents/Resources mkdir -p $(BUNDLE)/Contents/Resources
@@ -117,7 +117,7 @@ ifeq ($(ARCH), mac)
cd dist && ln -s /Library/Audio/Plug-Ins/VST VST cd dist && ln -s /Library/Audio/Plug-Ins/VST VST
cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg
endif endif
ifeq ($(ARCH), win)
ifdef ARCH_WIN
mkdir -p dist/Rack mkdir -p dist/Rack
mkdir -p dist/Rack/Bridge mkdir -p dist/Rack/Bridge
cp Bridge/vst/dist/VCV-Bridge-64.dll dist/Rack/Bridge/ cp Bridge/vst/dist/VCV-Bridge-64.dll dist/Rack/Bridge/
@@ -135,7 +135,7 @@ ifeq ($(ARCH), win)
makensis installer.nsi makensis installer.nsi
mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
endif endif
ifeq ($(ARCH), lin)
ifdef ARCH_LIN
mkdir -p dist/Rack mkdir -p dist/Rack
cp -R LICENSE* res dist/Rack/ cp -R LICENSE* res dist/Rack/
cp $(TARGET) dist/Rack/ cp $(TARGET) dist/Rack/
@@ -153,7 +153,7 @@ endif
cp -R include dist/Rack-SDK/ cp -R include dist/Rack-SDK/
mkdir -p dist/Rack-SDK/dep/ mkdir -p dist/Rack-SDK/dep/
cp -R dep/include dist/Rack-SDK/dep/ cp -R dep/include dist/Rack-SDK/dep/
ifeq ($(ARCH), win)
ifdef ARCH_WIN
cp libRack.a dist/Rack-SDK/ cp libRack.a dist/Rack-SDK/
endif endif
cd dist && zip -5 -r Rack-SDK-$(VERSION).zip Rack-SDK cd dist && zip -5 -r Rack-SDK-$(VERSION).zip Rack-SDK
@@ -162,14 +162,14 @@ endif
# Obviously this will only work if you have the private keys to my server # Obviously this will only work if you have the private keys to my server
UPLOAD_URL := vortico@vcvrack.com:files/ UPLOAD_URL := vortico@vcvrack.com:files/
upload: upload:
ifeq ($(ARCH), mac)
ifdef ARCH_MAC
rsync dist/*.dmg $(UPLOAD_URL) -zP rsync dist/*.dmg $(UPLOAD_URL) -zP
endif endif
ifeq ($(ARCH), win)
ifdef ARCH_WIN
rsync dist/*.exe $(UPLOAD_URL) -P rsync dist/*.exe $(UPLOAD_URL) -P
rsync dist/*.zip $(UPLOAD_URL) -P rsync dist/*.zip $(UPLOAD_URL) -P
endif endif
ifeq ($(ARCH), lin)
ifdef ARCH_LIN
rsync dist/*.zip $(UPLOAD_URL) -zP rsync dist/*.zip $(UPLOAD_URL) -zP
endif endif
rsync plugins/*/dist/*.zip $(UPLOAD_URL) -zP rsync plugins/*/dist/*.zip $(UPLOAD_URL) -zP


+ 16
- 20
arch.mk View File

@@ -1,24 +1,20 @@
# Detect architecture if ARCH is not defined

ifndef ARCH

MACHINE = $(shell $(CC) -dumpmachine) MACHINE = $(shell $(CC) -dumpmachine)
ifneq (, $(findstring linux, $(MACHINE)))
# Linux
ARCH = lin
else ifneq (, $(findstring apple, $(MACHINE)))
# Mac
ARCH = mac
ifneq (, $(findstring apple, $(MACHINE)))
ARCH_MAC := 1
ARCH := mac
else ifneq (, $(findstring mingw, $(MACHINE))) else ifneq (, $(findstring mingw, $(MACHINE)))
# Windows
ARCH = win
ifneq ( ,$(findstring x86_64, $(MACHINE)))
BITS = 64
else ifneq (, $(findstring i686, $(MACHINE)))
BITS = 32
endif
ARCH_WIN := 1
ARCH := win
ifneq ( ,$(findstring x86_64, $(MACHINE)))
ARCH_WIN_64 := 1
BITS := 64
else ifneq (, $(findstring i686, $(MACHINE)))
ARCH_WIN_32 := 1
BITS := 32
endif
else ifneq (, $(findstring linux, $(MACHINE)))
ARCH_LIN := 1
ARCH := lin
else else
$(error Could not determine machine type. Try hacking around in arch.mk)
$(error Could not determine architecture. Try hacking around in arch.mk)
endif endif

endif

+ 3
- 3
compile.mk View File

@@ -22,10 +22,10 @@ endif
CXXFLAGS += -std=c++11 CXXFLAGS += -std=c++11




ifeq ($(ARCH), lin)
ifdef ARCH_LIN
FLAGS += -DARCH_LIN FLAGS += -DARCH_LIN
endif endif
ifeq ($(ARCH), mac)
ifdef ARCH_MAC
FLAGS += -DARCH_MAC FLAGS += -DARCH_MAC
CXXFLAGS += -stdlib=libc++ CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++ LDFLAGS += -stdlib=libc++
@@ -33,7 +33,7 @@ ifeq ($(ARCH), mac)
FLAGS += $(MAC_SDK_FLAGS) FLAGS += $(MAC_SDK_FLAGS)
LDFLAGS += $(MAC_SDK_FLAGS) LDFLAGS += $(MAC_SDK_FLAGS)
endif endif
ifeq ($(ARCH), win)
ifdef ARCH_WIN
FLAGS += -DARCH_WIN FLAGS += -DARCH_WIN
FLAGS += -D_USE_MATH_DEFINES FLAGS += -D_USE_MATH_DEFINES
endif endif


+ 9
- 9
dep/Makefile View File

@@ -6,7 +6,7 @@ RACK_DIR ?= ..


include $(RACK_DIR)/arch.mk include $(RACK_DIR)/arch.mk


ifeq ($(ARCH), lin)
ifdef ARCH_LIN
glew = lib/libGLEW.a glew = lib/libGLEW.a
glfw = lib/libglfw3.a glfw = lib/libglfw3.a
jansson = lib/libjansson.a jansson = lib/libjansson.a
@@ -19,7 +19,7 @@ ifeq ($(ARCH), lin)
openssl = lib/libssl.a openssl = lib/libssl.a
endif endif


ifeq ($(ARCH), mac)
ifdef ARCH_MAC
glew = lib/libGLEW.a glew = lib/libGLEW.a
glfw = lib/libglfw3.a glfw = lib/libglfw3.a
jansson = lib/libjansson.a jansson = lib/libjansson.a
@@ -32,7 +32,7 @@ ifeq ($(ARCH), mac)
openssl = lib/libssl.a openssl = lib/libssl.a
endif endif


ifeq ($(ARCH), win)
ifdef ARCH_WIN
glew = lib/libglew32.a glew = lib/libglew32.a
glfw = lib/libglfw3.a glfw = lib/libglfw3.a
jansson = lib/libjansson.a jansson = lib/libjansson.a
@@ -112,7 +112,7 @@ $(libzip): $(zlib)
$(zlib): $(zlib):
$(WGET) "https://www.zlib.net/zlib-1.2.11.tar.gz" $(WGET) "https://www.zlib.net/zlib-1.2.11.tar.gz"
$(UNTAR) zlib-1.2.11.tar.gz $(UNTAR) zlib-1.2.11.tar.gz
ifeq ($(ARCH), win)
ifdef ARCH_WIN
$(MAKE) -C zlib-1.2.11 -f win32/Makefile.gcc $(MAKE) -C zlib-1.2.11 -f win32/Makefile.gcc
$(MAKE) -C zlib-1.2.11 -f win32/Makefile.gcc BINARY_PATH="$(realpath $(DEP_LOCAL))/bin" INCLUDE_PATH="$(realpath $(DEP_LOCAL))/include" LIBRARY_PATH="$(realpath $(DEP_LOCAL))/lib" install $(MAKE) -C zlib-1.2.11 -f win32/Makefile.gcc BINARY_PATH="$(realpath $(DEP_LOCAL))/bin" INCLUDE_PATH="$(realpath $(DEP_LOCAL))/include" LIBRARY_PATH="$(realpath $(DEP_LOCAL))/lib" install
else else
@@ -128,21 +128,21 @@ $(rtmidi):
$(MAKE) -C rtmidi $(MAKE) -C rtmidi
$(MAKE) -C rtmidi install $(MAKE) -C rtmidi install


ifeq ($(ARCH), mac)
ifdef ARCH_MAC
RTAUDIO_FLAGS += -DAUDIO_OSX_CORE=ON RTAUDIO_FLAGS += -DAUDIO_OSX_CORE=ON
endif endif
ifeq ($(ARCH), win)
ifdef ARCH_WIN
RTAUDIO_FLAGS += -DAUDIO_WINDOWS_DS=ON -DAUDIO_WINDOWS_WASAPI=ON -DAUDIO_WINDOWS_ASIO=ON RTAUDIO_FLAGS += -DAUDIO_WINDOWS_DS=ON -DAUDIO_WINDOWS_WASAPI=ON -DAUDIO_WINDOWS_ASIO=ON
endif endif
ifeq ($(ARCH), lin)
ifdef ARCH_LIN
RTAUDIO_FLAGS += -DAUDIO_LINUX_ALSA=ON -DAUDIO_UNIX_JACK=ON RTAUDIO_FLAGS += -DAUDIO_LINUX_ALSA=ON -DAUDIO_UNIX_JACK=ON
endif endif


ifdef RTAUDIO_ALL_APIS ifdef RTAUDIO_ALL_APIS
ifeq ($(ARCH), mac)
ifdef ARCH_MAC
RTAUDIO_FLAGS += -DAUDIO_UNIX_JACK=ON RTAUDIO_FLAGS += -DAUDIO_UNIX_JACK=ON
endif endif
ifeq ($(ARCH), lin)
ifdef ARCH_LIN
RTAUDIO_FLAGS += -DAUDIO_LINUX_PULSE=ON RTAUDIO_FLAGS += -DAUDIO_LINUX_PULSE=ON
endif endif
endif endif


+ 4
- 4
plugin.mk View File

@@ -15,19 +15,19 @@ FLAGS += -I$(RACK_DIR)/include -I$(RACK_DIR)/dep/include


include $(RACK_DIR)/arch.mk include $(RACK_DIR)/arch.mk


ifeq ($(ARCH), lin)
ifdef ARCH_LIN
LDFLAGS += -shared LDFLAGS += -shared
TARGET := plugin.so TARGET := plugin.so
RACK_USER_DIR ?= $(HOME)/.Rack RACK_USER_DIR ?= $(HOME)/.Rack
endif endif


ifeq ($(ARCH), mac)
ifdef ARCH_MAC
LDFLAGS += -shared -undefined dynamic_lookup LDFLAGS += -shared -undefined dynamic_lookup
TARGET := plugin.dylib TARGET := plugin.dylib
RACK_USER_DIR ?= $(HOME)/Documents/Rack RACK_USER_DIR ?= $(HOME)/Documents/Rack
endif endif


ifeq ($(ARCH), win)
ifdef ARCH_WIN
LDFLAGS += -shared -L$(RACK_DIR) -lRack LDFLAGS += -shared -L$(RACK_DIR) -lRack
TARGET := plugin.dll TARGET := plugin.dll
RACK_USER_DIR ?= $(USERPROFILE)/Documents/Rack RACK_USER_DIR ?= $(USERPROFILE)/Documents/Rack
@@ -50,7 +50,7 @@ dist: all
mkdir -p dist/$(SLUG) mkdir -p dist/$(SLUG)
# Strip and copy plugin binary # Strip and copy plugin binary
cp $(TARGET) dist/$(SLUG)/ cp $(TARGET) dist/$(SLUG)/
ifeq ($(ARCH), mac)
ifdef ARCH_MAC
$(STRIP) -S dist/$(SLUG)/$(TARGET) $(STRIP) -S dist/$(SLUG)/$(TARGET)
else else
$(STRIP) -s dist/$(SLUG)/$(TARGET) $(STRIP) -s dist/$(SLUG)/$(TARGET)


Loading…
Cancel
Save