diff --git a/Makefile b/Makefile index 191a6e6f7..93a3ce457 100644 --- a/Makefile +++ b/Makefile @@ -15,9 +15,9 @@ all: extension csql # build extension extension: $(MAKE) -C src/backend/distributed/ all -install-extension: +install-extension: extension $(MAKE) -C src/backend/distributed/ install -install-headers: +install-headers: extension $(MKDIR_P) '$(includedir_server)/distributed/' # generated headers are located in the build directory $(INSTALL_DATA) src/include/citus_config.h '$(includedir_server)/' @@ -33,7 +33,7 @@ clean: clean-extension # build csql binary csql: $(MAKE) -C src/bin/csql/ all -install-csql: +install-csql: csql $(MAKE) -C src/bin/csql/ install clean-csql: $(MAKE) -C src/bin/csql/ clean diff --git a/Makefile.global.in b/Makefile.global.in index 60b3d31f0..9fc3459ab 100644 --- a/Makefile.global.in +++ b/Makefile.global.in @@ -19,6 +19,9 @@ vpath_build=@vpath_build@ ifeq ($(vpath_build),yes) VPATH:=$(citus_abs_srcdir) USE_VPATH:=$(VPATH) + citus_top_srcdir:=$(citus_abs_top_srcdir) +else + citus_top_srcdir:=$(citus_top_builddir) endif # Citus is built using PostgreSQL's pgxs @@ -32,17 +35,17 @@ include $(PGXS) # with some outdated Makefile.global. # Make internally restarts whenever included Makefiles are # regenerated. -$(citus_top_builddir)/Makefile.global: $(citus_top_builddir)/Makefile.global.in @top_srcdir@/configure $(citus_top_builddir)/config.status +$(citus_top_builddir)/Makefile.global: $(citus_abs_top_srcdir)/configure $(citus_top_builddir)/Makefile.global.in $(citus_top_builddir)/config.status cd @abs_top_builddir@ && ./config.status Makefile.global # Ensure configuration is generated by the most recent configure, # useful for longer existing build directories. -$(citus_top_builddir)/config.status: @top_srcdir@/configure +$(citus_top_builddir)/config.status: $(citus_abs_top_srcdir)/configure cd @abs_top_builddir@ && ./config.status --recheck # Regenerate configure if configure.in changed -@top_srcdir@/configure: $(citus_abs_srcdir)/configure.in - cd ${citus_abs_srcdir} && ./autogen.sh +$(citus_abs_top_srcdir)/configure: $(citus_abs_top_srcdir)/configure.in + cd ${citus_abs_top_srcdir} && ./autogen.sh # If specified via configure, replace the default compiler. Normally # we'll build with the one postgres was built with. But it's useful to diff --git a/configure b/configure index aaf84be6a..8c418df55 100755 --- a/configure +++ b/configure @@ -1893,7 +1893,9 @@ fi # Allow to overwrite the C compiler, default to the one postgres was -# compiled with +# compiled with. We don't want autoconf's default CFLAGS though, so save +# those. +SAVE_CFLAGS="$CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2491,6 +2493,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +CFLAGS="$SAVE_CFLAGS" # check for a number of CFLAGS that make development easier diff --git a/configure.in b/configure.in index 5248f36f5..7ef13e2eb 100644 --- a/configure.in +++ b/configure.in @@ -52,8 +52,11 @@ fi AC_SUBST(vpath_build) # Allow to overwrite the C compiler, default to the one postgres was -# compiled with +# compiled with. We don't want autoconf's default CFLAGS though, so save +# those. +SAVE_CFLAGS="$CFLAGS" AC_PROG_CC([$($PG_CONFIG --cc)]) +CFLAGS="$SAVE_CFLAGS" # check for a number of CFLAGS that make development easier diff --git a/src/backend/distributed/Makefile b/src/backend/distributed/Makefile index 8f4bd899a..052800bbe 100644 --- a/src/backend/distributed/Makefile +++ b/src/backend/distributed/Makefile @@ -7,7 +7,8 @@ MODULE_big = citus EXTENSION = citus EXTVERSION = 5.0 DATA_built = $(EXTENSION)--$(EXTVERSION).sql -SCRIPTS = $(wildcard $(citus_top_builddir)/src/bin/scripts/*) +# Install scripts in build and/or source directory, but only once if those are the same +SCRIPTS = $(sort $(wildcard $(citus_top_builddir)/src/bin/scripts/* $(citus_top_srcdir)/src/bin/scripts/*)) # directories with source files SUBDIRS = . commands executor master planner relay test utils worker @@ -17,13 +18,13 @@ SUBDIRS = . commands executor master planner relay test utils worker OBJS += \ $(patsubst $(citus_abs_srcdir)/%.c,%.o,$(foreach dir,$(SUBDIRS), $(wildcard $(citus_abs_srcdir)/$(dir)/*.c))) +# be explicit about the default target +all: + # define build process for latest install file $(EXTENSION)--$(EXTVERSION).sql: $(EXTENSION).sql cat $^ > $@ -# be explicit about the default target -all: - NO_PGXS = 1 SHLIB_LINK = $(libpq)