srcdir = @srcdir@ top_srcdir = @top_srcdir@ # Where does the installation go ? PREFIX=@prefix@ DESTDIR=@DESTDIR@ LIBSUBDIR=@LIBSUBDIR@ BINDIR=$(DESTDIR)$(PREFIX)/bin LIBDIR=$(DESTDIR)$(PREFIX)/$(LIBSUBDIR) INCLUDEDIR=$(DESTDIR)$(PREFIX)/include # filename conventions EXE=@EXEEXT@ OBJ=@OBJEXT@ # compilers used. LIBDYNPFX=@LIBDYNPFX@ LIBDYN=@LIBDYN@ ABI_VERSION=1 VERSION=@VERSION@ SVN_VERSION=$(shell $(top_srcdir)/scripts/get_svn_version.sh $(top_srcdir)) CC = @CC@ CXX = @CXX@ LD = @CXX@ # add -I.. in order to find config.h CFLAGS = \ @CFLAGS@ @DYN_CFLAGS@ @DEFS@ @XML_CFLAGS@ -DFANCYXMLSOCK_BUILD_SLIB -I.. -I$(srcdir) -I$(top_srcdir)/fancylog -I$(top_srcdir)/fancybase -I$(top_srcdir)/fancysock CXXFLAGS = \ @CXXFLAGS@ @DYN_CFLAGS@ @DEFS@ @XML_CFLAGS@ -DFANCYXMLSOCK_BUILD_SLIB -I.. -I$(srcdir) -I$(top_srcdir)/fancylog -I$(top_srcdir)/fancybase -I$(top_srcdir)/fancysock LDFLAGS = @LDFLAGS@ @DYN_LDFLAGS@ # Win32 resource compiler RC=@RC@ RCFLAGS=@RCFLAGS@ ifeq ($(RC),) LIBALIAS=$(LIBDYNPFX)fancyxmlsock.$(LIBDYN) LIBRARY=$(LIBDYNPFX)fancyxmlsock.$(LIBDYN).$(ABI_VERSION) IMPLIBRARY= LDVERFLAGS=-Wl,-soname,$(LIBRARY) LIBTARGETDIR=$(LIBDIR) RESOBJS= else LIBALIAS= LIBRARY=$(LIBDYNPFX)fancyxmlsock-$(ABI_VERSION).$(LIBDYN) IMPLIBRARY=libfancyxmlsock.$(LIBDYN).a LDVERFLAGS=-Wl,--out-implib=$(IMPLIBRARY) LIBTARGETDIR=$(BINDIR) RESOBJS=fancyxmlsock_res.$(OBJ) comma:= , COMMA_VERSION=$(subst .,$(comma),$(VERSION))$(comma)$(SVN_VERSION) %_res.$(OBJ): $(srcdir)/%.rc sed -e 's/__COMMA_VERSION__/$(COMMA_VERSION)/g' -e 's/__VERSION__/$(VERSION)-$(SVN_VERSION)/g' -e 's/__ABI_VERSION__/$(ABI_VERSION)/g' < $< > $*_res.rc $(RC) $(RCFLAGS) $*_res.rc $*_res.$(OBJ) endif #libraries, which are in the same source tree. BASELIBRARIES=fancysock fancybase fancylog BASELIBRARYTARGETS=$(addprefix ../,$(addsuffix /library-stamp,$(BASELIBRARIES))) LIBS=$(addprefix -L../,$(BASELIBRARIES)) $(addprefix -l,$(BASELIBRARIES)) @XML_LIBS@ @LIBS@ @RESOLV_LIBS@ %.depend: $(srcdir)/%.c $(CC) $(CFLAGS) -M $< -o $@ %.depend: $(srcdir)/%.cpp $(CXX) $(CXXFLAGS) -M $< -o $@ %.$(OBJ): $(srcdir)/%.c $(CC) $(CFLAGS) -c $< -o $@ %.$(OBJ): $(srcdir)/%.cpp $(CXX) $(CXXFLAGS) -c $< -o $@ all: Makefile build-dep Makefile: $(srcdir)/Makefile.in echo "Updating out-of-date Makefiles..." ../reconfigure.sh build-dep: make dep=yes build build: $(LIBRARY) clean:: rm -f *.depend *.a *.$(OBJ) *_res.rc *~ *.bak .*~ .*.bak core library-stamp rm -rf $(LIBRARY) $(LIBALIAS) distclean:: clean rm -f Makefile # dummy target for xrefs foo: ../%/library-stamp: foo cd ../$*; $(MAKE) library-stamp # # objects # OBJECTS = fancyxmlsockencoding.$(OBJ) \ fancyxmlsockiostream.$(OBJ) \ fancyxmlsockloopdaemon.$(OBJ) \ fancyxmlsockloops.$(OBJ) \ fancyxmlsockloopserver.$(OBJ) \ fancyxmlsockprotocol.$(OBJ) \ fancyxmlsockhttpprotocol.$(OBJ) \ fancyxmlsockdom.$(OBJ) HEADERS = fancyxmlsock.h \ fancyxmlsockloopdaemon.h \ fancyxmlsockloops.h \ fancyxmlsockloopserver.h \ fancyxmlsockiostream.h \ fancyxmlsockencoding.h \ fancyxmlsockhttpprotocol.h \ fancyxmlsockprotocol.h \ fancyxmlsockdom.h $(LIBRARY) library-stamp: $(OBJECTS) $(RESOBJS) $(BASELIBRARYTARGETS) -rm -f $@ $(LIBALIAS) $(LD) $(LDFLAGS) $(LDVERFLAGS) $(OBJECTS) $(RESOBJS) $(LIBS) -o $(LIBRARY) if test x$(LIBALIAS) != x; then ln -s $(LIBRARY) $(LIBALIAS); fi touch library-stamp install: all if [ ! -d $(LIBDIR) ] ; then mkdir -p $(LIBDIR); fi if [ ! -d $(LIBTARGETDIR) ] ; then mkdir -p $(LIBTARGETDIR); fi cp $(LIBRARY) $(LIBTARGETDIR) cd $(LIBTARGETDIR); chmod 644 $(LIBRARY) if test x$(LIBALIAS) != x; then cd $(LIBTARGETDIR) && rm -f $(LIBALIAS) && ln -s $(LIBRARY) $(LIBALIAS); fi if test x$(IMPLIBRARY) != x; then cp $(IMPLIBRARY) $(LIBDIR) && cd $(LIBDIR) && chmod 644 $(IMPLIBRARY); fi if [ ! -d $(INCLUDEDIR) ] ; then mkdir $(INCLUDEDIR); fi for file in $(HEADERS); do cmp -s $(srcdir)/$$file $(INCLUDEDIR)/$$file || cp -p $(srcdir)/$$file $(INCLUDEDIR)/$$file; done cd $(INCLUDEDIR); chmod 644 $(HEADERS) # # dependencies # ifeq ($(dep),yes) include $(addsuffix .depend, $(basename $(OBJECTS))) endif