← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcpp-plugin-sdk-cpp/trunk] Rev 34: makefile fix for cross-compilation

 

------------------------------------------------------------
revno: 34
committer: poy <poy@xxxxxxxxxx>
branch nick: dcpp-plugin-sdk-cpp
timestamp: Thu 2013-06-20 18:57:55 +0200
message:
  makefile fix for cross-compilation
modified:
  projects/make/Makefile


--
lp:dcpp-plugin-sdk-cpp
https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcpp-plugin-sdk-cpp.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/trunk/+edit-subscription
=== modified file 'projects/make/Makefile'
--- projects/make/Makefile	2013-06-18 21:40:18 +0000
+++ projects/make/Makefile	2013-06-20 16:57:55 +0000
@@ -33,10 +33,16 @@
 
 COMPILER_SPEC = $(shell $(CC) -dumpmachine)
 
-ifeq ($(findstring mingw, $(COMPILER_SPEC)),)
-	BINEXT =
-	LIBEXT = .so
-else
+ifneq ($(findstring mingw, $(COMPILER_SPEC)),)
+	WIN_TARGET = 1
+endif
+ifeq ($(OS), Windows_NT)
+	ifeq ($(findstring Cygwin, $(SHELL)),)
+		WIN_SHELL = 1
+	endif
+endif
+
+ifdef WIN_TARGET
 	BINEXT = .exe
 	CPPFLAGS += -D_WIN32_WINNT=0x502 -DWINVER=0x502 -D_WIN32_IE=0x600 \
 				-DNOMINMAX -DSTRICT -DWIN32_LEAN_AND_MEAN \
@@ -44,6 +50,9 @@
 	LIBEXT = .dll
 	OBJS += src/resource.o
 	OUTPUT_DIR := $(OUTPUT_DIR)-mingw
+else
+	BINEXT =
+	LIBEXT = .so
 endif
 
 ifeq ($(findstring x86_64, $(COMPILER_SPEC)),)
@@ -55,31 +64,26 @@
 	TARGET := $(TARGET)-x64
 endif
 
-ifeq ($(OS), Windows_NT)
-	ifeq ($(findstring Cygwin, $(SHELL)),)
-		MKDIR = if not exist $(subst /,\,$1) md $(subst /,\,$1)
-		RMDIR = if exist $(subst /,\,$1) rd /s /q $(subst /,\,$1)
-	else
-		MKDIR = mkdir -p $1
-		RMDIR = $(RM) -r $1
-	endif
+ifdef WIN_SHELL
+	MKDIR = if not exist $(subst /,\,$1) md $(subst /,\,$1)
+	RMDIR = if exist $(subst /,\,$1) rd /s /q $(subst /,\,$1)
 else
 	MKDIR = mkdir -p $1
 	RMDIR = $(RM) -r $1
 endif
 
-ifeq ($(findstring mingw, $(COMPILER_SPEC)),)
-	PDB =
-else
+ifdef WIN_TARGET
 	PDB := $(OUTPUT_DIR)/$(TARGET).pdb
 
-	ifeq ($(findstring Cygwin, $(SHELL)),)
+	ifdef WIN_SHELL
 		RCFLAGS := -DPLUGIN_FILE_NAME="^\\"$(TARGET)\\"" \
 			-DPLUGIN_FILE_NAME_EXT="^\\"$(TARGET)$(LIBEXT)\\""
 	else
 		RCFLAGS := -DPLUGIN_FILE_NAME="\\\"$(TARGET)\\\"" \
 			-DPLUGIN_FILE_NAME_EXT="\\\"$(TARGET)$(LIBEXT)\\\""
 	endif
+else
+	PDB =
 endif
 
 TARGET := $(OUTPUT_DIR)/$(TARGET)$(LIBEXT)
@@ -93,7 +97,7 @@
 $(TARGET): $(OBJS)
 	$(CXX) $^ $(LINKFLAGS) $(LINKXXFLAGS) $(OUTPUT_OPTION)
 
-ifneq ($(findstring mingw, $(COMPILER_SPEC)),)
+ifdef WIN_TARGET
 $(PDB): $(TARGET)
 	strip --only-keep-debug $< $(OUTPUT_OPTION) && strip $<
 endif
@@ -110,7 +114,7 @@
 $(OUTPUT_DIR)/%.o: %.cpp
 	$(COMPILE.cpp) $< $(OUTPUT_OPTION)
 
-ifneq ($(findstring mingw, $(COMPILER_SPEC)),)
+ifdef WIN_TARGET
 $(OUTPUT_DIR)/%.o: %.rc
 	windres $< $(RCFLAGS) $(OUTPUT_OPTION)
 endif