##
##  smk.stdtargets -- Standard Targets for GNU autoconf based Makefiles
##  Copyright (c) 1994-1999 Ralf S. Engelschall, All Rights Reserved. 
##

.pri -10

#   The enhanced .c -> .o extension target
#   It will optionally transform the ANSI sources into K&R style
#   before compilation to be able to compile under pre-ANSI compilers.
EXEC = echo "$$cmd"; eval "$$cmd"
.c.o:
	-@if test X$(ANSI_CC) = Xyes; then \
	    cmd="$(CC) $(CFLAGS) $(ACDEFS) $(INCL) -c -o $@ $<"; \
	    $(EXEC); \
	else \
	    cmd="$(CC) -E $(CFLAGS) $(ACDEFS) $(INCL) $< | $(top_srcdir)/etc/unproto/unproto >U_$<"; \
	    $(EXEC); \
	    cmd="$(CC) -c -o $@ U_$<"; \
	    $(EXEC); \
	    cmd="rm -f U_$<"; \
	    $(EXEC); \
	fi

#   This is the dummy target, i.e. the FIRST REAL target in the
#   makefile which will nothing do than call "all". We use
#   this trick to be able to later overwrite the "all" target
#   but to make sure that the first target is this running the
#   "all" target.
dummy: all

#   fix package after a fresh checkout from the repository 
#   i.e. recreate symbolic links and unpack binary files, etc.
fixdist:
	@$(MoveToSubDirs)

#   configure the fresh package, i.e. run GNU autoconf etc.
config:
	@PreTargets=fixdist; $(RunPreTargets)
	@$(MoveToSubDirs)

#   should run ``makedepend'' on all sources to get
#   dependencies into Makefile 
depend:
	@$(MoveToSubDirs)

#   should run ``cproto'' on all sources to create
#   prototypes for all sources.
proto:
	@$(MoveToSubDirs)

#   should run ``ctags'' on all sources to create
#   tags file for vi  
tags:
	@$(MoveToSubDirs)

#   should run ``etags'' on all sources to create
#   tags file for Emacs  
TAGS:
	@$(MoveToSubDirs)

#   the "all" target which is the default for
#   creation of all programs etc., except dokumentation files
all: $(TARGETS)
	@$(MoveToSubDirs)

#   the "alldocs" target which creates all documentation files
alldocs:
	@$(MoveToSubDirs)

#   check the compiled programs, etc. without prior installation
#   i.e. just a local check!
check:
	@$(MoveToSubDirs)

#   create all installation directories
installdirs:
	@$(MoveToSubDirs)

#   install all programs, except documentation files
install:
	@PreTargets=all; $(RunPreTargets)
	@$(MoveToSubDirs)

#   install all documentation files
installdocs:
	@PreTargets=alldoc; $(RunPreTargets)
	@$(MoveToSubDirs)

#   check the installed programs, etc.
installcheck:
	@$(MoveToSubDirs)

#   uninstall ALL, i.e. all programs, all ducumentation files
#   and all created installation directories
uninstall:
	@$(MoveToSubDirs)

#   clean out mostly files
mostlyclean:
	@$(MoveToSubDirs)

#   clean all things which can be recreated by the "all" target
clean:
	@PreTargets=mostlyclean; $(RunPreTargets)
	@$(MoveToSubDirs)

#   clean out all files which should not distributed
distclean:
	@PreTargets=clean; $(RunPreTargets)
	@$(MoveToSubDirs)
	-rm -f Makefile

#   clean out all files which should not saved to the repository 
commitclean:
	@PreTargets="unfixdist clean"; $(RunPreTargets)
	@$(MoveToSubDirs)
	-rm -f Makefile Makefile.in

#   clean out all which can be recreated
realclean:
	@PreTargets=distclean; $(RunPreTargets)
	@$(MoveToSubDirs)

#   remove all fixed things from the package
unfixdist:
	@$(MoveToSubDirs)

#   prepare local dir for distribution
dist:
	@$(MoveToSubDirs)
	@PreTargets="unfixdist distclean"; $(RunPreTargets)

#   make a log to the ChangeLog file
log:
	cd $(top_srcdir); \
	emacs -f add-change-log-entry ./ChangeLog; \
	rm -f ./ChangeLog~ #ChangeLog#

#   recreate myself, i.e. this Makefile inclusive reconfigure it via autoconf
myself:
	smkmf -I$(top_srcdir)/config/include -q
	-@cwd=`pwd`; cd $(top_srcdir); topdir=`pwd`; cd $$cwd; \
	mysrcdir=`echo $$cwd | sed -e "s|$${topdir}/*||"`; \
	if [ x$$mysrcdir = x ]; then \
	    mysrcfile=Makefile; \
	else \
	    mysrcfile=$$mysrcdir/Makefile; \
	fi; \
	CONFIG_FILES=$$mysrcfile; \
	export CONFIG_FILES; \
	CONFIG_HEADERS=; \
	export CONFIG_HEADERS; \
	echo "CONFIG_FILES=$$mysrcfile; CONFIG_HEADERS=; cd $(top_srcdir); $${CONFIG_SHELL-/bin/sh} ./config.status"; \
	cd $(top_srcdir); $${CONFIG_SHELL-/bin/sh} ./config.status;

.pri +10

