d528a0f020
target names so that both sets of rules can coexist in the same file. The configure script selects which one to use. - use patterns to build plugins. - remove Makefile, which was specific to win32.
60 lines
1.7 KiB
Makefile
60 lines
1.7 KiB
Makefile
top_builddir = ..
|
|
top_srcdir = @srcdir@/..
|
|
srcdir = @srcdir@
|
|
VPATH = @srcdir@
|
|
|
|
CXX=@CXX@
|
|
CXXFLAGS=@CXXFLAGS@ @INCLTDL@
|
|
LDFLAGS=@LDFLAGS@ @LT_LDFLAGS@
|
|
LIBS=@LIBS@ @LIBLTDL@
|
|
|
|
LIBTOOL=@LIBTOOL@
|
|
RPATH=`pwd`/lib
|
|
|
|
# select whether to use libtool or win32-specific target.
|
|
# This should either be all_libtool or all_win32_dlltool.
|
|
all: @PLUGIN_MAKEFILE_TARGET@
|
|
|
|
########### libtool makefile for all platforms except win32 ###########
|
|
all_libtool: uselib libmodule1.la libmodule2.la
|
|
|
|
uselib: main.lo
|
|
$(LIBTOOL) $(CXX) -export-dynamic $(LDFLAGS) -o uselib main.lo $(LIBS)
|
|
|
|
lib%.la: %.lo
|
|
$(LIBTOOL) $(CXX) -module $(LDFLAGS) -o $@ $< -rpath ${RPATH}
|
|
mkdir -p lib bin
|
|
$(LIBTOOL) cp $@ ${RPATH}
|
|
|
|
%.lo: %.cc
|
|
$(LIBTOOL) $(CXX) $(CXXFLAGS) -c $<
|
|
#######################################################################
|
|
|
|
############# makefile for building plugin DLLs for win32 #############
|
|
all_win32_dlltool: uselib.exe module1.dll module2.dll
|
|
|
|
uselib.exe: main.cc main.h
|
|
$(CXX) $(CXXFLAGS) -c -DDLL_EXPORT -o main.o ${srcdir}/main.cc
|
|
dlltool --output-def uselib.def main.o
|
|
dlltool --dllname uselib.exe --def uselib.def --output-lib uselib.a
|
|
dlltool --dllname uselib.exe --output-exp uselib.exp --def uselib.def
|
|
$(CXX) $(CXXFLAGS) -o uselib.exe uselib.exp main.o ${LIBS}
|
|
#rm uselib.exp uselib.def
|
|
|
|
%.dll: %.o uselib.exe
|
|
$(CXX) $(CXXFLAGS) -shared -o $@ $< uselib.a
|
|
|
|
%.o: %.cc
|
|
$(CXX) $(CXXFLAGS) -c $<
|
|
#######################################################################
|
|
|
|
test:
|
|
@echo "*** Running test in `pwd`"
|
|
-./uselib
|
|
@echo "*** Test done in `pwd`"
|
|
|
|
clean:
|
|
-$(LIBTOOL) rm libmodule1.la module1.lo libmodule2.la module2.lo
|
|
rm -rf *.o *.lo *.la uselib.exe bin lib uselib uselib.exe
|
|
rm -rf .libs
|