summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfalkTX <falktx@gmail.com>2018-09-17 21:25:02 +0200
committerfalkTX <falktx@gmail.com>2018-09-17 21:25:02 +0200
commitda2ef996e1892776c7308c40b1339479631a5e41 (patch)
tree945a1b0e3e4ea1749dc18101db533b76dc76d16e
parent72306e36099eab4afc2471849a0eb789b18a51a4 (diff)
Use root folder common Makefile to build DGL
-rw-r--r--README.md4
-rw-r--r--dgl/Makefile92
-rw-r--r--dgl/Makefile.mk127
3 files changed, 48 insertions, 175 deletions
diff --git a/README.md b/README.md
index 2464ac39..70254094 100644
--- a/README.md
+++ b/README.md
@@ -28,8 +28,8 @@ List of plugins made with DPF:<br/>
- [ZamAudio Suite](https://github.com/zamaudio/zam-plugins)
-Plugin examples are available [here](https://github.com/DISTRHO/plugin-examples).<br/>
-OpenGL UI examples are available [here](https://github.com/DISTRHO/gl-examples).
+Plugin examples are available in the `example/` folder inside this repo.<br/>
+Extra OpenGL UI examples are available [here](https://github.com/DISTRHO/gl-examples).
Online documentation is available at [https://distrho.github.io/DPF/](https://distrho.github.io/DPF/).
diff --git a/dgl/Makefile b/dgl/Makefile
index aa694c63..9a418d12 100644
--- a/dgl/Makefile
+++ b/dgl/Makefile
@@ -1,86 +1,86 @@
#!/usr/bin/make -f
-# Makefile for dgl #
+# Makefile for DGL #
# ---------------- #
# Created by falkTX
#
-include Makefile.mk
+include ../Makefile.mk
-# --------------------------------------------------------------
+# ---------------------------------------------------------------------------------------------------------------------
BUILD_C_FLAGS += $(DGL_FLAGS) -I. -Isrc
BUILD_CXX_FLAGS += $(DGL_FLAGS) -I. -Isrc
LINK_FLAGS += $(DGL_LIBS)
-ifneq ($(MACOS_OLD),true)
+# ifneq ($(MACOS_OLD),true)
# needed by sofd right now, fix later
-BUILD_CXX_FLAGS += -Wno-type-limits -fpermissive
-endif
+# BUILD_CXX_FLAGS += -Wno-type-limits -fpermissive
+# endif
-# --------------------------------------------------------------
+# ---------------------------------------------------------------------------------------------------------------------
OBJS = \
- src/Application.cpp.o \
- src/Color.cpp.o \
- src/Geometry.cpp.o \
- src/Image.cpp.o \
- src/ImageWidgets.cpp.o \
- src/NanoVG.cpp.o \
- src/Resources.cpp.o \
- src/Widget.cpp.o
+ ../build/dgl/Application.cpp.o \
+ ../build/dgl/Color.cpp.o \
+ ../build/dgl/Geometry.cpp.o \
+ ../build/dgl/Image.cpp.o \
+ ../build/dgl/ImageWidgets.cpp.o \
+ ../build/dgl/NanoVG.cpp.o \
+ ../build/dgl/Resources.cpp.o \
+ ../build/dgl/Widget.cpp.o
ifeq ($(MACOS),true)
-OBJS += src/Window.mm.o
+OBJS += ../build/dgl/Window.mm.o
else
-OBJS += src/Window.cpp.o
+OBJS += ../build/dgl/Window.cpp.o
endif
-TARGET = ../libdgl.a
+TARGET = ../build/libdgl.a
-# --------------------------------------------------------------
+# ---------------------------------------------------------------------------------------------------------------------
all: $(TARGET)
-# --------------------------------------------------------------
-
-../libdgl.a: $(OBJS)
- rm -f $@
- $(AR) crs $@ $^
-
-../libdgl.dll: $(OBJS)
- # -Wl,--output-def,$@.def,--out-implib,$@.a
- $(CXX) $^ -shared $(LINK_FLAGS) -o $@
-
-../libdgl.dylib: $(OBJS)
- $(CXX) $^ -dynamiclib $(LINK_FLAGS) -o $@
+# ---------------------------------------------------------------------------------------------------------------------
-../libdgl.so: $(OBJS)
- $(CXX) $^ -shared $(LINK_FLAGS) -o $@
+../build/libdgl.a: $(OBJS)
+ -@mkdir -p ../build
+ @echo "Creating libdgl.a"
+ @rm -f $@
+ @$(AR) crs $@ $^
-# --------------------------------------------------------------
+# ---------------------------------------------------------------------------------------------------------------------
-%.c.o: %.c
- $(CC) $< $(BUILD_C_FLAGS) -c -o $@
+../build/dgl/%.c.o: src/%.c
+ -@mkdir -p ../build/dgl
+ @echo "Compiling $<"
+ @$(CC) $< $(BUILD_C_FLAGS) -c -o $@
-%.cpp.o: %.cpp
- $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
+../build/dgl/%.cpp.o: src/%.cpp
+ -@mkdir -p ../build/dgl
+ @echo "Compiling $<"
+ @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
-src/Window.cpp.o: src/Window.cpp src/pugl/*
- $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
+../build/dgl/Window.cpp.o: src/Window.cpp src/sofd/* src/pugl/*
+ -@mkdir -p ../build/dgl
+ @echo "Compiling $<"
+ @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
-src/Window.mm.o: src/Window.cpp src/pugl/*
- $(CXX) $< $(BUILD_CXX_FLAGS) -ObjC++ -c -o $@
+../build/dgl/Window.mm.o: src/Window.cpp src/sofd/* src/pugl/*
+ -@mkdir -p ../build/dgl
+ @echo "Compiling $<"
+ @$(CXX) $< $(BUILD_CXX_FLAGS) -ObjC++ -c -o $@
-# --------------------------------------------------------------
+# ---------------------------------------------------------------------------------------------------------------------
clean:
- rm -f src/*.d src/*.o ../libdgl.*
+ rm -rf ../build/dgl ../build/libdgl.*
debug:
$(MAKE) DEBUG=true
-# --------------------------------------------------------------
+# ---------------------------------------------------------------------------------------------------------------------
-include $(OBJS:%.o=%.d)
-# --------------------------------------------------------------
+# ---------------------------------------------------------------------------------------------------------------------
diff --git a/dgl/Makefile.mk b/dgl/Makefile.mk
deleted file mode 100644
index 74829ee4..00000000
--- a/dgl/Makefile.mk
+++ /dev/null
@@ -1,127 +0,0 @@
-#!/usr/bin/make -f
-# Makefile for dgl #
-# ---------------- #
-# Created by falkTX
-#
-
-AR ?= ar
-CC ?= gcc
-CXX ?= g++
-
-# --------------------------------------------------------------
-# Fallback to Linux if no other OS defined
-
-ifneq ($(HAIKU),true)
-ifneq ($(MACOS),true)
-ifneq ($(WIN32),true)
-LINUX=true
-endif
-endif
-endif
-
-# --------------------------------------------------------------
-# Set build and link flags
-
-BASE_FLAGS = -Wall -Wextra -pipe -MD -MP
-BASE_OPTS = -O2 -mtune=generic -msse -msse2 -fdata-sections -ffunction-sections
-
-ifeq ($(MACOS),true)
-# MacOS linker flags
-LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-dead_strip -Wl,-dead_strip_dylibs
-else
-# Common linker flags
-LINK_OPTS = -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
-endif
-
-ifeq ($(RASPPI),true)
-# Raspberry-Pi optimization flags
-BASE_OPTS = -O2 -march=armv6 -mfpu=vfp -mfloat-abi=hard
-LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
-endif
-
-ifeq ($(NOOPT),true)
-# No optimization flags
-BASE_OPTS = -O2 -fdata-sections -ffunction-sections
-endif
-
-ifneq ($(WIN32),true)
-# not needed for Windows
-BASE_FLAGS += -fPIC -DPIC
-endif
-
-ifeq ($(DEBUG),true)
-BASE_FLAGS += -DDEBUG -O0 -g
-LINK_OPTS =
-else
-BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
-CXXFLAGS += -fvisibility-inlines-hidden
-endif
-
-BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 $(CFLAGS)
-BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++11 $(CXXFLAGS) $(CPPFLAGS)
-
-ifeq ($(MACOS),true)
-# 'no-undefined' is always enabled
-LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
-else
-# Specify 'no-undefined'
-LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS)
-endif
-
-ifeq ($(MACOS_OLD),true)
-# No C++11 support
-BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS) $(CPPFLAGS)
-endif
-
-# --------------------------------------------------------------
-# Strict test build
-
-ifeq ($(TESTBUILD),true)
-BASE_FLAGS += -Werror -Wcast-qual -Wconversion -Wformat -Wformat-security -Wredundant-decls -Wshadow -Wstrict-overflow -fstrict-overflow -Wundef -Wwrite-strings
-BASE_FLAGS += -Wpointer-arith -Wabi -Winit-self -Wuninitialized -Wstrict-overflow=5
-# BASE_FLAGS += -Wfloat-equal
-ifeq ($(CC),clang)
-BASE_FLAGS += -Wdocumentation -Wdocumentation-unknown-command
-BASE_FLAGS += -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-exit-time-destructors -Wno-float-equal
-else
-BASE_FLAGS += -Wcast-align -Wunsafe-loop-optimizations
-endif
-ifneq ($(MACOS),true)
-BASE_FLAGS += -Wmissing-declarations -Wsign-conversion
-ifneq ($(CC),clang)
-BASE_FLAGS += -Wlogical-op
-endif
-endif
-CFLAGS += -Wold-style-definition -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
-CXXFLAGS += -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual
-endif
-
-# --------------------------------------------------------------
-# Check for required libs
-
-ifeq ($(LINUX),true)
-ifneq ($(shell pkg-config --exists gl && echo true),true)
-$(error OpenGL missing, cannot continue)
-endif
-ifneq ($(shell pkg-config --exists x11 && echo true),true)
-$(error X11 missing, cannot continue)
-endif
-endif
-
-# --------------------------------------------------------------
-# Set libs stuff
-
-ifeq ($(LINUX),true)
-DGL_FLAGS = $(shell pkg-config --cflags gl x11)
-DGL_LIBS = $(shell pkg-config --libs gl x11)
-endif
-
-ifeq ($(MACOS),true)
-DGL_LIBS = -framework OpenGL -framework Cocoa
-endif
-
-ifeq ($(WIN32),true)
-DGL_LIBS = -lopengl32 -lgdi32
-endif
-
-# --------------------------------------------------------------