From eae9e48b74aed51cbacbab52461577f0b67d5d82 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Wed, 8 Oct 2008 01:15:10 -0400 Subject: [PATCH] Cleaned up vxodbc Makefiles by relying on wvrules.mk. I hope this makes things better rather than worse. --- vxodbc/.gitignore | 2 ++ vxodbc/{Makefile-common => Makefile} | 46 +++++++++++++++---------------- vxodbc/Makefile-linux | 26 +++--------------- vxodbc/Makefile-win32 | 52 ++++++++---------------------------- 4 files changed, 40 insertions(+), 86 deletions(-) rename vxodbc/{Makefile-common => Makefile} (59%) diff --git a/vxodbc/.gitignore b/vxodbc/.gitignore index 83db565..9a466f9 100644 --- a/vxodbc/.gitignore +++ b/vxodbc/.gitignore @@ -10,3 +10,5 @@ stamp-h1 linker-test *.a *.map +CC +CXX diff --git a/vxodbc/Makefile-common b/vxodbc/Makefile similarity index 59% rename from vxodbc/Makefile-common rename to vxodbc/Makefile index a87fc2c..ed204a2 100644 --- a/vxodbc/Makefile-common +++ b/vxodbc/Makefile @@ -1,4 +1,20 @@ -default: all +include ../config.mk +WVSTREAMS:=$(shell pwd)/../wv/wvstreams +include $(WVSTREAMS)/wvrules.mk + +ifndef BUILD_TARGET +$(error Please run the "configure" or "configure-mingw32" script in ..) +endif + +WVPORTS=../wv/wvports +XPLC=$(WVPORTS)/xplc/build/xplc +OPENSSL=$(WVPORTS)/openssl/build/openssl +DBUS=$(WVPORTS)/dbus/build/dbus/dbus/.libs +BOOST=$(WVPORTS)/boost/build/boost +ZLIB=$(WVPORTS)/zlib/build/zlib +CXXFLAGS+=-w \ + -DUNICODE_SUPPORT -DODBCVER=0x0351 \ + -I$(WVSTREAMS)/include -I$(XPLC)/include -I$(BOOST) OBJS=\ bind.o \ @@ -50,28 +66,6 @@ clean: rm -f *.o *.so *~ *.res *.dll *.a .*.d *.d $(MAKE) -C t $@ -%.E: %.c - $(CC) -o $@ -E $< $(CFLAGS) - -%.E: %.cc - $(CC) -o $@ -E $< $(CXXFLAGS) - -%.o: %.c - @if [ -z "$VERBOSE" ]; then \ - echo Compiling $@...; \ - else \ - echo $(CC) -o $@ -c -MMD -MP -MF .$*.d $< $(CFLAGS); \ - fi; \ - $(CC) -o $@ -c -MMD -MP -MF .$*.d $< $(CFLAGS); - -%.o: %.cc - @if [ -z "$VERBOSE" ]; then \ - echo Compiling $@...; \ - else \ - echo $(CXX) -o $@ -c -MMD -MP -MF .$*.d $< $(CXXFLAGS); \ - fi; \ - $(CXX) -o $@ -c -MMD -MP -MF .$*.d $< $(CXXFLAGS); - config.h.in: configure.ac aclocal.m4 autoheader @@ -82,3 +76,9 @@ include $(wildcard .*.d) test tests: $(MAKE) -C t $@ + +ifeq ($(BUILD_TARGET),win32) +include Makefile-win32 +else +include Makefile-linux +endif diff --git a/vxodbc/Makefile-linux b/vxodbc/Makefile-linux index 1b58697..9d374ed 100644 --- a/vxodbc/Makefile-linux +++ b/vxodbc/Makefile-linux @@ -1,32 +1,14 @@ -include Makefile-common - -WVPORTS=../wv/wvports -XPLC=$(WVPORTS)/xplc/build/xplc -OPENSSL=$(WVPORTS)/openssl/build/openssl -DBUS=$(WVPORTS)/dbus/build/dbus/dbus/.libs -BOOST=$(WVPORTS)/boost/build/boost -ZLIB=$(WVPORTS)/zlib/build/zlib -WVSTREAMS=../wv/wvstreams -CFLAGS=-g -w \ - -DUNICODE_SUPPORT -DODBCVER=0x0351 \ - -I$(WVSTREAMS)/include -I$(XPLC)/include \ - -I/usr/include/postgresql -CXXFLAGS=$(CFLAGS) -I$(BOOST) -WVSTREAMS_STATIC=$(WVSTREAMS)/libwvstatic.a LIBS=\ - $(WVSTREAMS_STATIC) \ $(DBUS)/libdbus-1.a \ $(OPENSSL)/libssl.a $(OPENSSL)/libcrypto.a \ $(ZLIB)/libz.a \ $(XPLC)/libxplc-cxx.a $(XPLC)/libxplc.a -ldl \ /usr/lib/libodbc.a -lpthread -DYNLIBS=\ - -L$(WVSTREAMS) -lwvstreams -lwvdbus -lodbc LDFLAGS=-g all: wvdbusd.so vxodbc.so vxodbc-test.so test-linker -wvdbusd.so: wvdbusd.o $(WVSTREAMS_STATIC) +wvdbusd.so: wvdbusd.o $(LIBWVSTATIC) @echo Linking $@... @$(CXX) -shared -o $@ \ $(LDFLAGS) \ @@ -37,7 +19,7 @@ wvdbusd.so: wvdbusd.o $(WVSTREAMS_STATIC) $(OBJS): configure config.h -vxodbc.so: $(OBJS) $(WVSTREAMS_STATIC) +vxodbc.so: $(OBJS) $(LIBWVSTATIC) @echo Linking $@... @$(CXX) -shared -o $@ \ $(LDFLAGS) \ @@ -47,7 +29,7 @@ vxodbc.so: $(OBJS) $(WVSTREAMS_STATIC) $(LIBS) # Build a dynamically linked version suitable for use by unit tests -vxodbc-test.so: $(OBJS) +vxodbc-test.so: $(OBJS) $(LIBWVSTATIC) @echo Linking $@... @$(CXX) -shared -o $@ \ $(LDFLAGS) \ @@ -55,7 +37,7 @@ vxodbc-test.so: $(OBJS) -Wl,--soname,$@ \ $(DYNLIBS) -linker-test: linker-test.o vxodbc.so +linker-test: linker-test.o vxodbc.so $(LIBWVSTATIC) @echo Linking $@... $(CXX) -o $@ $(LDFLAGS) $^ diff --git a/vxodbc/Makefile-win32 b/vxodbc/Makefile-win32 index 7fe4a45..3d332c6 100644 --- a/vxodbc/Makefile-win32 +++ b/vxodbc/Makefile-win32 @@ -1,26 +1,11 @@ -include Makefile-common - -CC=i586-mingw32msvc-g++ -CXX=i586-mingw32msvc-g++ WINDRES=i586-mingw32msvc-windres -WVPORTS=../wv/wvports -XPLC=$(WVPORTS)/xplc/build/xplc -OPENSSL=$(WVPORTS)/openssl/build/openssl -DBUS=$(WVPORTS)/dbus/build/dbus/dbus/.libs -BOOST=$(WVPORTS)/boost/build/boost -ZLIB=$(WVPORTS)/zlib/build/zlib W32API=$(WVPORTS)/win32api/build/w32api -WVSTREAMS=../wv/wvstreams -CFLAGS=-w \ +CXXFLAGS+=\ -D_MSC_VER=1300 \ - -DUNICODE_SUPPORT -DODBCVER=0x0351 -D_WIN32_WINNT=0x0501 \ + -D_WIN32_WINNT=0x0501 \ -DWIN_MULTITHREAD_SUPPORT \ - -I$(WVSTREAMS)/include -I$(XPLC)/include -I$(BOOST) \ - -I/usr/include/postgresql -I$(W32API)/include -CXXFLAGS=$(CFLAGS) -RSCFLAGS=-DUNICODE_SUPPORT + -I$(W32API)/include LIBS=\ - -L$(WVSTREAMS) -lwvstatic \ -L$(DBUS) -ldbus-1 \ -L$(XPLC) -lxplc-cxx -lxplc \ -L$(OPENSSL) -lssl -lcrypto \ @@ -35,43 +20,28 @@ OBJS+=\ setup.o \ vxodbc.res.o \ vxodbc.def - - + all: wvdbusd.dll vxodbc.dll regwriter.exe %.res.o: %.rc $(WINDRES) $< $@ -wvdbusd.dll: wvdbusd.o wvdbusd.def +%.dll: %.def @echo Linking $@... @$(CXX) \ -o $@ \ -shared \ $(LDFLAGS) \ $^ \ - -Wl,--out-implib,wvdbusd.a \ - -Wl,-Map,wvdbusd.map \ + -Wl,--out-implib,$*.a \ + -Wl,-Map,$*.map \ $(LIBS) \ 2>&1 | grep -v '^Warning: resolving .* by linking to' >&2 -vxodbc.dll: $(OBJS) - @echo Linking $@... - @$(CXX) \ - -o $@ \ - -shared \ - $(LDFLAGS) \ - $^ \ - -Wl,--out-implib,vxodbc.a \ - -Wl,-Map,vxodbc.map \ - $(LIBS) \ - 2>&1 | grep -v '^Warning: resolving .* by linking to' >&2 +wvdbusd.dll: wvdbusd.o $(LIBWVSTATIC) -regwriter.exe: regwriter.o - @echo Linking $@... - @$(CXX) \ - -o $@ \ - $(LDFLAGS) \ - $^ \ - $(LIBS) +vxodbc.dll: $(OBJS) $(LIBWVSTATIC) + +regwriter.exe: regwriter.o $(LIBWVSTATIC) test: vxodbc.dll vxodbc.a -- 2.11.4.GIT