# Makefile for erServer demonstration implementation
# (c) 2000 Vadim Mikheev, PostgreSQL Inc.
-#vpath %.pl perl
-#vpath %.pm perl
-
subdir = contrib/rserv
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
NAME = rserv
-OBJS = $(NAME).o
-DOCS = README.$(NAME)
+SONAME = $(NAME)$(DLSUFFIX)
SQLS = master.sql slave.sql
TCLS = RservTest
PERLS = MasterInit MasterAddTable Replicate MasterSync CleanLog
PERLS += SlaveInit SlaveAddTable GetSyncID
PERLS += PrepareSnapshot ApplySnapshot
-LIBS = RServ.pm
SCRIPTS = InitRservTest
-MODS = $(OBJS:.o=$(DLSUFFIX))
override CPPFLAGS += -I$(srcdir)
override CFLAGS += $(CFLAGS_SL)
-INPUTFILES = $(wildcard *.in)
-CLEANFILES = $(INPUTFILES:.in=)
-CLEANFILES += $(OBJS) $(MODS)
-
-.PHONY: all install installdirs tarball
-
-all: $(SQLS) $(TCLS) $(PERLS) $(SCRIPTS) $(MODS)
-install: all installdirs
- $(INSTALL_DATA) $(SQLS) $(libdir)/contrib
- $(INSTALL_SCRIPT) $(TCLS) $(PERLS) $(SCRIPTS) $(bindir)
- $(INSTALL_SCRIPT) $(LIBS) $(libdir)/contrib
- $(INSTALL_SHLIB) $(MODS) $(libdir)/contrib
- $(INSTALL_DATA) $(DOCS) $(docdir)/contrib/$(NAME)
-
-installdirs:
- $(mkinstalldirs) $(datadir)/contrib $(libdir)/contrib $(docdir)/contrib/$(NAME)
+all: $(SQLS) $(TCLS) $(PERLS) $(SCRIPTS) $(SONAME)
%.sql: %.sql.in
- rm -f $@; \
- C=`pwd`; \
sed -e "s:_OBJWD_:$(libdir)/contrib:g" \
- -e "s:_DLSUFFIX_:$(DLSUFFIX):g" < $< > $@
+ -e "s:_DLSUFFIX_:$(DLSUFFIX):g" $< >$@
-%: %.in
+$(PERLS) $(TCLS) $(SCRIPTS): %: %.in
sed -e "s:_OBJWD_:$(libdir)/contrib:g" \
-e "s:_DLSUFFIX_:$(DLSUFFIX):g" \
- -e "s:@SQLDIR@:$(libdir)/contrib:g" \
+ -e "s:@SQLDIR@:$(datadir)/contrib:g" \
-e "s:@BINDIR@:$(bindir):g" \
- -e "s:@LIBDIR@:$(libdir)/contrib:g" < $< > $@
- chmod 775 $@
+ -e "s:@LIBDIR@:$(datadir)/contrib:g" $< >$@
+ chmod a+x $@
+
+
+install: all installdirs
+ for file in $(SQLS); do \
+ $(INSTALL_DATA) $$file $(DESTDIR)$(datadir)/contrib || exit ; \
+ done
+ for file in $(TCLS) $(PERLS) $(SCRIPTS); do \
+ $(INSTALL_SCRIPT) $$file $(DESTDIR)$(bindir) || exit ; \
+ done
+ $(INSTALL_DATA) RServ.pm $(DESTDIR)$(datadir)/contrib
+ $(INSTALL_SHLIB) $(SONAME) $(DESTDIR)$(libdir)/contrib
+ $(INSTALL_DATA) README.$(NAME) $(DESTDIR)$(docdir)/contrib
+
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(datadir)/contrib \
+ $(DESTDIR)$(libdir)/contrib $(DESTDIR)$(docdir)/contrib
+
-clean:
-# @echo "Removing $(CLEANFILES)"
- rm -f $(CLEANFILES)
+clean distclean maintainer-clean:
+ rm -f $(SQLS) $(TCLS) $(PERLS) $(SCRIPTS) $(SONAME) $(NAME).o