commit e7e3e9f2e530b905aa2b7b3878f9eff03965630a
parent efbd38a12119073f4b3fecea883cc2f11c298529
Author: falkTX <falktx@gmail.com>
Date: Sun, 19 Apr 2015 15:36:12 +0200
Update makefile
Diffstat:
2 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/dgl/Makefile b/dgl/Makefile
@@ -43,7 +43,7 @@ all: $(TARGET)
../libdgl.a: $(OBJS)
rm -f $@
- ar crs $@ $^
+ $(AR) crs $@ $^
../libdgl.dll: $(OBJS)
# -Wl,--output-def,$@.def,--out-implib,$@.a
@@ -78,3 +78,7 @@ debug:
$(MAKE) DEBUG=true
# --------------------------------------------------------------
+
+-include $(OBJS:%.o=%.d)
+
+# --------------------------------------------------------------
diff --git a/dgl/Makefile.mk b/dgl/Makefile.mk
@@ -4,6 +4,7 @@
# Created by falkTX
#
+AR ?= ar
CC ?= gcc
CXX ?= g++
@@ -19,38 +20,41 @@ endif
endif
# --------------------------------------------------------------
-# Common build and link flags
+# Set build and link flags
-BASE_FLAGS = -Wall -Wextra -pipe
-BASE_OPTS = -O2 -ffast-math -fdata-sections -ffunction-sections
-ifneq ($(NOOPT),true)
-BASE_OPTS += -mtune=generic -msse -msse2 -mfpmath=sse
+BASE_FLAGS = -Wall -Wextra -pipe -MD -MP
+BASE_OPTS = -O2 -ffast-math -mtune=generic -msse -msse2 -fdata-sections -ffunction-sections
+
+ifneq ($(MACOS),true)
+# MacOS doesn't support this
+BASE_OPTS += -mfpmath=sse
endif
-LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-O1 -Wl,--as-needed -Wl,--gc-sections -Wl,--strip-all
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 flags
-BASE_OPTS = -O2 -ffast-math
-ifneq ($(NOOPT),true)
-BASE_OPTS += -march=armv6 -mfpu=vfp -mfloat-abi=hard
-endif
+# Raspberry-Pi optimization flags
+BASE_OPTS = -O2 -ffast-math -march=armv6 -mfpu=vfp -mfloat-abi=hard
LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
endif
ifeq ($(PANDORA),true)
-# OpenPandora flags
-BASE_OPTS = -O2 -ffast-math
-ifneq ($(NOOPT),true)
-BASE_OPTS += -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
-endif
+# OpenPandora optimization flags
+BASE_OPTS = -O2 -ffast-math -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
endif
+ifneq ($(NOOPT),true)
+# No optimization flags
+BASE_OPTS = -O2 -ffast-math -fdata-sections -ffunction-sections
+endif
+
ifneq ($(WIN32),true)
# not needed for Windows
BASE_FLAGS += -fPIC -DPIC