diff --git a/Makefile b/Makefile index ccf6cdff..eaabc814 100644 --- a/Makefile +++ b/Makefile @@ -1,50 +1,52 @@ include Makefile-arch.inc FLAGS += \ - -I./ext -I./include + -I./include SOURCES = $(wildcard src/*.cpp src/*/*.cpp) \ ext/nanovg/src/nanovg.c ifeq ($(ARCH), lin) -SOURCES += ext/osdialog/osdialog_gtk2.c -CFLAGS += $(shell pkg-config --cflags gtk+-2.0) -LDFLAGS += -rdynamic \ - -lpthread -lGL -ldl \ - -lportaudio -lportmidi \ - -Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip \ - $(shell pkg-config --libs gtk+-2.0) -TARGET = Rack + SOURCES += ext/osdialog/osdialog_gtk2.c + CFLAGS += $(shell pkg-config --cflags gtk+-2.0) + LDFLAGS += -rdynamic \ + -lpthread -lGL -ldl \ + $(shell pkg-config --libs gtk+-2.0) \ + -Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip -lportaudio -lportmidi + TARGET = Rack endif ifeq ($(ARCH), mac) -SOURCES += ext/osdialog/osdialog_mac.m -CXXFLAGS += -DAPPLE -stdlib=libc++ -I$(HOME)/local/include -I/usr/local/lib/libzip/include -LDFLAGS += -stdlib=libc++ -L$(HOME)/local/lib -lpthread -lglew -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -ldl -ljansson -lportaudio -lportmidi -lsamplerate -lcurl -lzip -TARGET = Rack + SOURCES += ext/osdialog/osdialog_mac.m + CXXFLAGS += -DAPPLE -stdlib=libc++ -I$(HOME)/local/include -I/usr/local/lib/libzip/include + LDFLAGS += -stdlib=libc++ -L$(HOME)/local/lib -lpthread -lglew -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -ldl -ljansson -lportaudio -lportmidi -lsamplerate -lcurl -lzip + TARGET = Rack endif ifeq ($(ARCH), win) -SOURCES += ext/osdialog/osdialog_win.c -CXXFLAGS += -DGLEW_STATIC \ - -I$(HOME)/pkg/portaudio-r1891-build/include -I/mingw64/lib/libzip/include -I$(HOME)/local/include -LDFLAGS += \ - -Wl,-Bstatic,--whole-archive \ - -ljansson -lsamplerate \ - -Wl,-Bdynamic,--no-whole-archive \ - -lpthread -lglfw3 -lgdi32 -lglew32 -lopengl32 -lcomdlg32 -lole32 -lzip \ - -L $(HOME)/local/lib -lcurl \ - -lportmidi \ - -L$(HOME)/pkg/portaudio-r1891-build/lib/x64/ReleaseMinDependency -lportaudio_x64 \ - -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows -TARGET = Rack.exe -# OBJECTS = Rack.res + SOURCES += ext/osdialog/osdialog_win.c + CXXFLAGS += -DGLEW_STATIC \ + -I$(HOME)/pkg/portaudio-r1891-build/include -I/mingw64/lib/libzip/include -I$(HOME)/local/include + LDFLAGS += \ + -Wl,-Bstatic,--whole-archive \ + -ljansson -lsamplerate \ + -Wl,-Bdynamic,--no-whole-archive \ + -lpthread -lglfw3 -lgdi32 -lglew32 -lopengl32 -lcomdlg32 -lole32 -lzip \ + -L $(HOME)/local/lib -lcurl \ + -lportmidi \ + -L$(HOME)/pkg/portaudio-r1891-build/lib/x64/ReleaseMinDependency -lportaudio_x64 \ + -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows + TARGET = Rack.exe + # OBJECTS = Rack.res endif all: $(TARGET) +run: $(TARGET) + ./$(TARGET) + clean: rm -rf $(TARGET) build diff --git a/Makefile.inc b/Makefile.inc index 21a56c6e..7ef00ad8 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -1,7 +1,7 @@ VERSION ?= dev FLAGS += -DVERSION=$(VERSION) -# Generate dependency files build/*.d +# Generate dependency files alongside the object files FLAGS += -MMD # Optimization FLAGS += -O3 -march=core2 -ffast-math @@ -10,28 +10,22 @@ CXXFLAGS += -std=c++11 ifeq ($(ARCH), lin) -CC ?= gcc -CXX ?= g++ -FLAGS += -DARCH_LIN + FLAGS += -DARCH_LIN endif ifeq ($(ARCH), mac) -CC ?= clang -CXX ?= clang++ -FLAGS += -DARCH_MAC -CXXFLAGS += -stdlib=libc++ -LDFLAGS += -stdlib=libc++ + FLAGS += -DARCH_MAC + CXXFLAGS += -stdlib=libc++ + LDFLAGS += -stdlib=libc++ endif ifeq ($(ARCH), win) -CC ?= x86_64-w64-mingw32-gcc -CXX ?= x86_64-w64-mingw32-g++ -FLAGS += -DARCH_WIN -D_USE_MATH_DEFINES + FLAGS += -DARCH_WIN -D_USE_MATH_DEFINES endif OBJECTS += $(patsubst %, build/%.o, $(SOURCES)) -DEPS = $(patsubst %, build/%.d, $(SOURCES)) +DEPS = $(patsubst %, %.d, $(OBJECTS)) # Final targets diff --git a/dep/Makefile b/dep/Makefile index b3388665..bbf07b56 100755 --- a/dep/Makefile +++ b/dep/Makefile @@ -78,13 +78,9 @@ $(libzip): $(MAKE) -C $@ install $(portmidi): - git clone https://github.com/aoeu/portmidi.git $@ - # TODO Does not yet work - cd $@ && cmake . -DCMAKE_INSTALL_PREFIX="$(LOCAL)" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=$(PWD)/$@/Release \ - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$(PWD)/$@/Release \ - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=$(PWD)/$@/Release + git clone https://github.com/AndrewBelt/portmidi.git $@ + # TODO Fix on Windows + cd $@ && cmake . -DCMAKE_INSTALL_PREFIX="$(LOCAL)" $(MAKE) -C $@ $(MAKE) -C $@ install