GIF89a; EcchiShell v1.0
//usr/lib64/lib64/lib64/pgsql/pgxs/$@ %.bz2: % $(BZIP2) -c $< >$@ # Direct builds of foo.c -> foo are disabled to avoid generating # *.dSYM junk on Macs. All builds should normally go through the # foo.c -> foo.o -> foo steps. This also ensures that dependency # tracking (see below) is used. %: %.c ifndef PGXS # Remake Makefile.global from Makefile.global.in if the latter # changed. In order to trigger this rule, the including file must # write `include $(top_builddir)/src/Makefile.global', not some # shortcut thereof. $(top_builddir)/src/Makefile.global: $(top_srcdir)/src/Makefile.global.in $(top_builddir)/config.status cd $(top_builddir) && ./config.status src/Makefile.global # Remake pg_config.h from pg_config.h.in if the latter changed. # config.status will not change the timestamp on pg_config.h if it # doesn't change, so as to avoid recompiling the entire tree # unnecessarily. Therefore we make config.status update a timestamp file # stamp-h every time it runs, so that we don't trigger this rule every time. # (We do trigger the null rule for stamp-h to pg_config.h every time; so it's # important for that rule to be empty!) # # Of course you need to turn on dependency tracking to get any # dependencies on pg_config.h. $(top_builddir)/src/include/pg_config.h: $(top_builddir)/src/include/stamp-h ; $(top_builddir)/src/include/stamp-h: $(top_srcdir)/src/include/pg_config.h.in $(top_builddir)/config.status cd $(top_builddir) && ./config.status src/include/pg_config.h # Also remake ecpg_config.h from ecpg_config.h.in if the latter changed, same # logic as above. $(top_builddir)/src/interfaces/ecpg/include/ecpg_config.h: $(top_builddir)/src/interfaces/ecpg/include/stamp-h ; $(top_builddir)/src/interfaces/ecpg/include/stamp-h: $(top_builddir)/src/interfaces/ecpg/include/ecpg_config.h.in $(top_builddir)/config.status cd $(top_builddir) && ./config.status src/interfaces/ecpg/include/ecpg_config.h # When configure changes, rerun configure with the same options as # last time. To change configure, you need to run autoconf manually. $(top_builddir)/config.status: $(top_srcdir)/configure cd $(top_builddir) && ./config.status --recheck endif # not PGXS install-strip: @$(MAKE) INSTALL_PROGRAM_ENV="STRIPPROG='$(STRIP)'" \ INSTALL_STLIB_ENV="STRIPPROG='$(STRIP_STATIC_LIB)'" \ INSTALL_SHLIB_ENV="STRIPPROG='$(STRIP_SHARED_LIB)'" \ INSTALL_STRIP_FLAG=-s \ install ########################################################################## # # Recursive make support # ---------------------- # Instead of recursing through subdirectories with a for loop or # repeated $(MAKE) -C whatever calls, this is a little smarter: it # allows parallel make across directories and lets make -k and -q work # correctly. # We need the $(eval) function and order-only prerequisites, which are # available in GNU make 3.80. That also happens to be the version # where the .VARIABLES variable was introduced, so this is a simple check. ifndef .VARIABLES $(error GNU make 3.80 or newer is required. You are using version $(MAKE_VERSION)) endif # This function is only for internal use below. It should be called # using $(eval). It will set up a target so that it recurses into # a given subdirectory. Note that to avoid a nasty bug in make 3.80, # this function has to avoid using any complicated constructs (like # multiple targets on a line) and also not contain any lines that expand # to more than about 200 bytes. This is why we make it apply to just one # subdirectory at a time, rather than to a list of subdirectories. # $1: target name, e.g., all # $2: subdir name # $3: target to run in subdir, usually same as $1 define _create_recursive_target .PHONY: $(1)-$(2)-recurse $(1): $(1)-$(2)-recurse $(1)-$(2)-recurse: $$(MAKE) -C $(2) $(3) endef # Note that the use of $$ on the last line above is important; we want # $(MAKE) to be evaluated when the rule is run, not when the $(eval) is run # to create the rule. This is necessary to get make -q working. # Call this function in a makefile that needs to recurse into subdirectories. # In the normal case all arguments can be defaulted. # $1: targets to make recursive (defaults to list of standard targets) # $2: list of subdirs (defaults to SUBDIRS variable) # $3: target to run in subdir (defaults to current element of $1) recurse = $(foreach target,$(if $1,$1,$(standard_targets)),$(foreach subdir,$(if $2,$2,$(SUBDIRS)),$(eval $(call _create_recursive_target,$(target),$(subdir),$(if $3,$3,$(target)))))) # If a makefile's list of SUBDIRS varies depending on configuration, then # any subdirectories excluded from SUBDIRS should instead be added to # ALWAYS_SUBDIRS, and then it must call recurse_always as well as recurse. # This ensures that distprep, distclean, etc will apply to all subdirectories. # In the normal case all arguments will be defaulted. # $1: targets to make recursive (defaults to standard_always_targets) # $2: list of subdirs (defaults to ALWAYS_SUBDIRS variable) # $3: target to run in subdir (defaults to current element of $1) recurse_always = $(foreach target,$(if $1,$1,$(standard_always_targets)),$(foreach subdir,$(if $2,$2,$(ALWAYS_SUBDIRS)),$(eval $(call _create_recursive_target,$(target),$(subdir),$(if $3,$3,$(target)))))) ########################################################################## # # Automatic dependency generation # ------------------------------- # When we configure with --enable-depend then we override the default # compilation rule with the magic below. While or after creating the # actual output file we also create a dependency list for the .c file. # Next time we invoke make we will have top-notch information about # whether this file needs to be updated. The dependency files are kept # in the .deps subdirectory of each directory. autodepend = ifeq ($(autodepend), yes) ifndef COMPILE.c COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c endif DEPDIR = .deps ifeq ($(GCC), yes) # GCC allows us to create object and dependency file in one invocation. %.o : %.c @if test ! -d $(DEPDIR); then mkdir -p $(DEPDIR); fi $(COMPILE.c) -o $@ $< -MMD -MP -MF $(DEPDIR)/$(*F).Po endif # GCC # Include all the dependency files generated for the current # directory. List /dev/null as dummy because if the wildcard expands # to nothing then make would complain. -include $(wildcard $(DEPDIR)/*.Po) /dev/null # hook for clean-up clean distclean maintainer-clean: clean-deps .PHONY: clean-deps clean-deps: @rm -rf $(DEPDIR) # When in automatic dependency mode, never delete any intermediate # files automatically. Otherwise, the following could happen: When # starting from a clean source tree, the first build would delete the # intermediate file, but also create the dependency file, which # mentions the intermediate file, thus making it non-intermediate. # The second build will then need to rebuild the now non-intermediate # missing file. So the second build will do work even though nothing # had changed. One place where this happens is the .c -> .o -> .so # chain for some contrib modules. .SECONDARY: endif # autodepend ########################################################################## # # Native language support ifeq ($(enable_nls), yes) ifneq (,$(wildcard $(srcdir)/nls.mk)) include $(top_srcdir)/src/nls-global.mk endif # nls.mk endif # enable_nls ########################################################################## # # Coverage # Explanation of involved files: # foo.c source file # foo.o object file # foo.gcno gcov graph (a.k.a. "notes") file, created at compile time # (by gcc -ftest-coverage) # foo.gcda gcov data file, created when the program is run (for # programs compiled with gcc -fprofile-arcs) # foo.c.gcov gcov output file with coverage information, created by # gcov from foo.gcda (by "make coverage") # foo.c.gcov.out stdout captured when foo.c.gcov is created, mildly # interesting # lcov.info lcov tracefile, built from gcda files in one directory, # later collected by "make coverage-html" ifeq ($(enable_coverage), yes) # There is a strange interaction between lcov and existing .gcov # output files. Hence the rm command and the ordering dependency. gcda_files := $(wildcard *.gcda) lcov.info: $(gcda_files) rm -f *.gcov $(if $^,$(LCOV) -d . -c -o $@ $(LCOVFLAGS)) %.c.gcov: %.gcda | lcov.info $(GCOV) -b -f -p -o . $(GCOVFLAGS) $*.c >$*.c.gcov.out coverage: $(gcda_files:.gcda=.c.gcov) lcov.info .PHONY: coverage-html coverage-html: coverage rm -rf coverage mkdir coverage $(GENHTML) --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=$(abs_top_srcdir) `find . -name lcov.info -print` # hook for clean-up clean distclean maintainer-clean: clean-coverage .PHONY: clean-coverage clean-coverage: rm -rf coverage rm -f *.gcda *.gcno lcov.info *.gcov *.gcov.out # User-callable target to reset counts between test runs coverage-clean: rm -f `find . -name '*.gcda' -print` endif # enable_coverage