# Where is the source code? 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@ LIBDYNPFX=@LIBDYNPFX@ LIBDYN=@LIBDYN@ ABI_VERSION=1 VERSION=@VERSION@ SVN_VERSION=$(shell $(top_srcdir)/scripts/get_svn_version.sh $(top_srcdir)) # C++ options. CXX=@CXX@ CXXFLAGS=@CXXFLAGS@ @DYN_CFLAGS@ @DEFS@ -DFANCYLOG_BUILD_SLIB -I$(srcdir) # C options. CC=@CC@ CFLAGS=@CFLAGS@ @DYN_CFLAGS@ @DEFS@ -DFANCYLOG_BUILD_SLIB -I$(srcdir) # link flags LD=@CC@ LDFLAGS=@LDFLAGS@ @DYN_LDFLAGS@ # ar options AR=@AR@ ARFLAGS=@ARFLAGS@ # Win32 resource compiler RC=@RC@ RCFLAGS=@RCFLAGS@ ifeq ($(RC),) LIBALIAS=$(LIBDYNPFX)fancylog.$(LIBDYN) LIBRARY=$(LIBDYNPFX)fancylog.$(LIBDYN).$(ABI_VERSION) IMPLIBRARY= LDVERFLAGS=-Wl,-soname,$(LIBRARY) LIBTARGETDIR=$(LIBDIR) RESOBJS= else LIBALIAS= LIBRARY=$(LIBDYNPFX)fancylog-$(ABI_VERSION).$(LIBDYN) IMPLIBRARY=libfancylog.$(LIBDYN).a LDVERFLAGS=-Wl,--out-implib=$(IMPLIBRARY) LIBTARGETDIR=$(BINDIR) RESOBJS=fancylog_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 %.$(OBJ): $(srcdir)/%.c $(CC) $(CFLAGS) -c $< -o $@ %.$(OBJ): $(srcdir)/%.cc $(CXX) $(CXXFLAGS) -c $< -o $@ %.depend: $(srcdir)/%.cc $(CXX) $(CXXFLAGS) -M $< > $@ %.depend: $(srcdir)/%.c $(CC) $(CFLAGS) -M $< > $@ OBJS=fancylog.$(OBJ) HEADERS=fancylog.h all: Makefile build-dep Makefile: $(srcdir)/Makefile.in echo "Updating out-of date Makefiles..." ../reconfigure.sh build-dep: make dep=yes build build: $(LIBRARY) 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) $(LIBRARY) library-stamp: $(OBJS) $(RESOBJS) -rm -f $@ $(LIBALIAS) $(LD) $(LDFLAGS) $(LDVERFLAGS) $^ -o $(LIBRARY) if test x$(LIBALIAS) != x; then ln -s $(LIBRARY) $(LIBALIAS); fi touch library-stamp clean: rm -f a.out core *~ *.bak .*~ .*.bak \#* *.log library-stamp rm -f *.depend *.a *.$(OBJ) *_res.rc $(LIBRARY) $(LIBALIAS) $(IMPLIBRARY) distclean: clean rm -f Makefile # include dependencies, if existent ifeq ($(dep),yes) include $(addsuffix .depend, $(basename $(OBJS))) endif