Browse Source

Refactor Makefiles

tags/v0.3.0
Andrew Belt 7 years ago
parent
commit
8bba88d448
3 changed files with 39 additions and 47 deletions
  1. +29
    -27
      Makefile
  2. +7
    -13
      Makefile.inc
  3. +3
    -7
      dep/Makefile

+ 29
- 27
Makefile View File

@@ -1,50 +1,52 @@
include Makefile-arch.inc include Makefile-arch.inc


FLAGS += \ FLAGS += \
-I./ext -I./include
-I./include


SOURCES = $(wildcard src/*.cpp src/*/*.cpp) \ SOURCES = $(wildcard src/*.cpp src/*/*.cpp) \
ext/nanovg/src/nanovg.c ext/nanovg/src/nanovg.c




ifeq ($(ARCH), lin) 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 endif


ifeq ($(ARCH), mac) 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 endif


ifeq ($(ARCH), win) 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 endif




all: $(TARGET) all: $(TARGET)


run: $(TARGET)
./$(TARGET)

clean: clean:
rm -rf $(TARGET) build rm -rf $(TARGET) build




+ 7
- 13
Makefile.inc View File

@@ -1,7 +1,7 @@
VERSION ?= dev VERSION ?= dev
FLAGS += -DVERSION=$(VERSION) FLAGS += -DVERSION=$(VERSION)


# Generate dependency files build/*.d
# Generate dependency files alongside the object files
FLAGS += -MMD FLAGS += -MMD
# Optimization # Optimization
FLAGS += -O3 -march=core2 -ffast-math FLAGS += -O3 -march=core2 -ffast-math
@@ -10,28 +10,22 @@ CXXFLAGS += -std=c++11




ifeq ($(ARCH), lin) ifeq ($(ARCH), lin)
CC ?= gcc
CXX ?= g++
FLAGS += -DARCH_LIN
FLAGS += -DARCH_LIN
endif endif


ifeq ($(ARCH), mac) 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 endif


ifeq ($(ARCH), win) 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 endif




OBJECTS += $(patsubst %, build/%.o, $(SOURCES)) OBJECTS += $(patsubst %, build/%.o, $(SOURCES))
DEPS = $(patsubst %, build/%.d, $(SOURCES))
DEPS = $(patsubst %, %.d, $(OBJECTS))




# Final targets # Final targets


+ 3
- 7
dep/Makefile View File

@@ -78,13 +78,9 @@ $(libzip):
$(MAKE) -C $@ install $(MAKE) -C $@ install


$(portmidi): $(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 $@
$(MAKE) -C $@ install $(MAKE) -C $@ install




Loading…
Cancel
Save