gnucash/Makefile.DEPS

152 lines
4.5 KiB
Makefile
Raw Normal View History

# Makefile.DEPS
#
# Automatically generate depends without actually building anything
# This is used for maintainers who won't or can't build all
# parts of a project before running make dist.
#
# Note this is only needed for automake 1.4 and requires gcc.
# If you're using automake 1.5, throw this monstrosity out!
# This is a gross hack, you really should NOT use this.
#
# YOU REALLY SHOULD NOT USE THIS
#
# Copyright 2003 John H. Pierce <john@killterm.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
#
# Have I mentioned YOU REALLY SHOULD NOT USE THIS?
#
# If you really must use this, add the following to the top level
# Makefile.am and see src/bin for strsub.
#
# Add to EXTRA_DIST Makefile.DEPS (this file) and "distdep-automake1.4-hack"
# Add these targets:
#
#distdep-automake1.4-hack: distdep
#
#distdep:
# $(MAKE) $(AM_MAKE_FLAGS) -f ${top_srcdir}/Makefile.DEPS \
# all-distdep-recursive
#
# If you're here trying to get rid of the delay comment out the next line
PAUSE = true
include Makefile
# override objects you don't want depended here
# This is needed for autogenerated sources you don't have the tools
# to build.
libgncswig_la_OBJECTS =
ifeq ($(strip $(DIST_SUBDIRS)),)
DISTDEP_SUBDIRS = $(SUBDIRS)
else
DISTDEP_SUBDIRS = $(DIST_SUBDIRS)
endif
# Filter out intl and po
ifeq ($(top_builddir), .)
DISTDEP_SUBDIRS := $(filter-out intl po, $(DISTDEP_SUBDIRS))
endif
# Get rid of -Werror because we don't get ANY deps then.
# Don't set CFLAGS or any other stuff in COMPILE after this.
COMPILE := $(filter-out -Werror, $(COMPILE))
STRSUB_PATH = $(top_builddir)/src/bin
STRSUB_BIN = strsub
STRSUB = $(STRSUB_PATH)/$(STRSUB_BIN)
ifeq ($(shell $(AUTOMAKE) --version | \
grep '(GNU automake) 1.4'), )
DONT_USE_THIS = donotuseme ;
else
DONT_USE_THIS = distdep-recursive
endif
donotuseme: ;
@echo "*************************************************************"
@echo "You should NOT use this script with this version of automake."
@echo "Read the comments in Makefile.DEPS"
@echo "To continue without this pause run 'make PAUSE=false dist'"
@echo "*************************************************************"
@if test x$(PAUSE) = xtrue; then \
echo -n "Pausing" ; \
i=0; while test $$i -lt 60; do \
echo -n . ; \
sleep 1 ; \
let "i=$$i+1" ; \
done ; \
echo "" ; \
fi
$(STRSUB):
$(MAKE) $(AM_MAKEFLAGS) -C $(STRSUB_PATH) $(STRSUB_BIN)
all: all-distdep-recursive ;
all-distdep-recursive: $(DONT_USE_THIS)
distdep-recursive: distdep-local
@full_tsdir=`cd ${top_srcdir} && pwd`; \
for subdir in $(DISTDEP_SUBDIRS); do \
if test "$$subdir" != "." && test -d "$$subdir"; then \
$(MAKE) $(AM_MAKEFLAGS) -f "$$full_tsdir/Makefile.DEPS" \
-C $$subdir all-distdep-recursive || exit 1; \
fi \
done
distdep-local: $(STRSUB) $(OBJECTS) ;
# sed plan
# turn:
# foo.o: bar.c ../blah.c \
# /usr/include/stdio.h top_srcdir/our-incs/baz.h \
# ../../src/built-header/built.h
# into
# foo.o : \
# bar.c \
# blah.c \
# top_builddir/baz.h \
# ../../src/built-header/built.h
#
# tr gets us 1 file per line
# s/^\\$// kill the trailing \'s
# s/^$/ kill empty lines
# /^\// d remove headers with absolute paths, they're system ones
# $(STRSUB) "$(top_srcdir)" "$(top_buildir)"
# make relative to build env
# VPATH takes care of non-srcdir build
# - Second sed invocation is to reset the line #'s
# 2,$s/^\(.*\)$/ \1 \\/ add leading space and \ to every line but 1
# 1s/$/ \\/ add space and \ to line 1
# $s/ \\$//' remove the space from the last line
%.o: %.c
@echo "creating .deps/$(*F).P"
@$(COMPILE) -MG -MM -o $@ $< | tr ' ' '\012' \
| $(STRSUB) "$(top_srcdir)" "$(top_builddir)" \
| sed -e 's/\\$$//' -e '/^$$/ d' -e '/^\// d' \
| sed -e '2,$$s/^\(.*\)$$/ \1 \\/' -e '1s/$$/ \\/' -e '$$s/ \\$$//' \
> .deps/$(*F).P || exit 1;
%.lo: %.c
@echo "creating .deps/$(*F).P"
@$(COMPILE) -MG -MM -o $@ $< | tr ' ' '\012' \
| $(STRSUB) "$(top_srcdir)" "$(top_builddir)" \
| sed -e 's/\\$$//' -e '/^$$/ d' -e '/^\// d' \
| sed -e '2,$$s/^\(.*\)$$/ \1 \\/' -e '1s/$$/ \\/' -e '$$s/ \\$$//' \
> .deps/$(*F).P || exit 1;