← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcpp-plugin-sdk-cpp/DevPlugin] Rev 23: merge

 

Merge authors:
  poy (poy)
------------------------------------------------------------
revno: 23 [merge]
committer: poy <poy@xxxxxxxxxx>
branch nick: DevPlugin
timestamp: Fri 2013-04-26 17:22:25 +0200
message:
  merge
added:
  packaging/make_dcext.bat
modified:
  .bzrignore
  projects/make/Makefile


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

Your team Dcplusplus-team is subscribed to branch lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/DevPlugin.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/DevPlugin/+edit-subscription
=== modified file '.bzrignore'
--- .bzrignore	2013-02-05 19:19:23 +0000
+++ .bzrignore	2013-04-26 15:22:25 +0000
@@ -1,3 +1,4 @@
+!packaging/make_dcext.bat
 *.asc
 *.aps
 *.bat

=== added file 'packaging/make_dcext.bat'
--- packaging/make_dcext.bat	1970-01-01 00:00:00 +0000
+++ packaging/make_dcext.bat	2013-04-26 15:22:25 +0000
@@ -0,0 +1,2 @@
+tar -czf DevPlugin.dcext info.xml DevPlugin-x86.dll DevPlugin-x64.dll DevPlugin.ico
+pause

=== modified file 'projects/make/Makefile'
--- projects/make/Makefile	2013-04-23 18:00:53 +0000
+++ projects/make/Makefile	2013-04-26 15:22:25 +0000
@@ -1,18 +1,20 @@
 # This is a rudimentary Makefile that compiles files from the pluginsdk & src directories into a
 # shared library. Adapt to your needs.
 
-TARGET = DevPlugin # Rename to your plugin's name.
+# Rename to your plugin's name.
+TARGET = DevPlugin
 
-CPPFLAGS += -march=i686 # Remove if your target architecture is not x86.
+CC = gcc
+CXX = g++
 
 CPPFLAGS += -Wall -Wextra -g -pipe -O3 -I../../
 CXXFLAGS += -std=gnu++0x
-LINKFLAGS += -static-libgcc -static-libstdc++ -g -O3 -shared -Wl,--add-stdcall-alias
+LINKFLAGS += -static-libgcc -g -O3 -shared -Wl,--add-stdcall-alias
+LINKXXFLAGS += -static-libstdc++
 
 VPATH = ../../
 
 OUTPUT_DIR = build
-OUTPUT_OPTION = -o $(OUTPUT_DIR)/$@
 
 OBJS = \
 	pluginsdk/Config.o \
@@ -30,28 +32,40 @@
 	src/Plugin.o \
 	src/stdafx.o
 
-ifeq ($(OS), Windows_NT)
+ifeq ($(findstring mingw, $(shell gcc -dumpmachine)),)
+	LIBEXT = .so
+else
 	CPPFLAGS += -D_WIN32_WINNT=0x502 -DWINVER=0x502 -D_WIN32_IE=0x600 \
 				-DNOMINMAX -DSTRICT -DWIN32_LEAN_AND_MEAN \
 				-DWIN32 -D_WIN32 -DUNICODE -D_UNICODE
+	LIBEXT = .dll
 	OBJS += src/resource.o
-	LIBEXT = .dll
+	OUTPUT_DIR := $(OUTPUT_DIR)-mingw
+endif
+
+ifeq ($(findstring x86_64, $(shell gcc -dumpmachine)),)
+	CPPFLAGS += -march=i686
+	OUTPUT_DIR := $(OUTPUT_DIR)-x86
+else
+	OUTPUT_DIR := $(OUTPUT_DIR)-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
+		RMDIR = $(RM) -r $1
 	endif
 else
-	LIBEXT = .so
 	MKDIR = mkdir -p $1
-	RMDIR += $(RM) -r $1
+	RMDIR = $(RM) -r $1
 endif
 
 # boost
 CPPFLAGS += -I../../boost
-ifeq ($(OS), Windows_NT)
+ifneq ($(findstring mingw, $(shell gcc -dumpmachine)),)
 	CPPFLAGS += -DBOOST_ALL_NO_LIB -DBOOST_USE_WINDOWS_H
 endif
 OBJS += \
@@ -76,7 +90,9 @@
 
 # dwt
 CPPFLAGS += -I../../dwt/include -DDWT_SHARED
-ifeq ($(OS), Windows_NT)
+ifeq ($(findstring mingw, $(shell gcc -dumpmachine)),)
+$(error "dwt requires a compiler with Windows as target")
+else
 	LINKFLAGS += -lcomctl32 -lcomdlg32 -lgdi32 -lole32 -lshlwapi -luuid -luxtheme
 endif
 OBJS += dwt/src/Application.o dwt/src/Bitmap.o dwt/src/Brush.o dwt/src/CanvasClasses.o \
@@ -102,14 +118,26 @@
 	dwt/src/widgets/TextBox.o dwt/src/widgets/ToolBar.o dwt/src/widgets/ToolTip.o \
 	dwt/src/widgets/Tree.o dwt/src/widgets/VirtualTree.o dwt/src/widgets/Window.o
 
-all: \
-	ensure-dirs \
-	$(TARGET)
+TARGET := $(OUTPUT_DIR)/$(TARGET)$(LIBEXT)
+OBJS := $(addprefix $(OUTPUT_DIR)/, $(OBJS))
+
+all: $(TARGET)
 
 $(TARGET): $(OBJS)
-	cd $(OUTPUT_DIR) && $(CXX) $^ $(LINKFLAGS) -o $@$(LIBEXT)
-
-ensure-dirs:
+	$(CXX) $^ $(LINKFLAGS) $(LINKXXFLAGS) $(OUTPUT_OPTION)
+
+$(OUTPUT_DIR)/%.o: %.c
+	$(COMPILE.c) $< $(OUTPUT_OPTION)
+
+$(OUTPUT_DIR)/%.o: %.cpp
+	$(COMPILE.cpp) $< $(OUTPUT_OPTION)
+
+$(OUTPUT_DIR)/%.o: %.rc
+	windres $< $(OUTPUT_OPTION)
+
+$(OBJS): | $(OUTPUT_DIR)
+
+$(OUTPUT_DIR):
 	$(call MKDIR,$(OUTPUT_DIR)/pluginsdk)
 	$(call MKDIR,$(OUTPUT_DIR)/src)
 	$(call MKDIR,$(OUTPUT_DIR)/boost/libs/atomic/src)
@@ -117,8 +145,5 @@
 	$(call MKDIR,$(OUTPUT_DIR)/dwt/src/util/win32)
 	$(call MKDIR,$(OUTPUT_DIR)/dwt/src/widgets)
 
-src/resource.o:
-	windres ../../src/resource.rc $(OUTPUT_OPTION)
-
-clear:
+clean:
 	$(call RMDIR,$(OUTPUT_DIR))