# $Header: /home/amb/cxref/cpp/RCS/Makefile.in 1.11 2004/06/22 17:32:24 amb Exp $
#
# C Cross Referencing & Documentation tool. Version 1.6.
#
# CPP Makefile.
#
# Written by Andrew M. Bishop
#
# This file Copyright 1995,96,99,2000,01,02,04 Andrew M. Bishop
# It may be distributed under the GNU Public License, version 2, or
# any higher version.  See section COPYING of the GNU Public license
# for conditions under which this file may be redistributed.
#

# autoconf things

srcdir=@srcdir@
VPATH=@srcdir@

# The installation locations

prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=$(DESTDIR)@bindir@
mandir=$(DESTDIR)@mandir@
datadir=$(DESTDIR)@datadir@/cxref

# The installation program.

INSTALL=@INSTALL@

# The C compiler and linker

CC=@CC@
LD=@CC@

CFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@

# The Yacc program

YACC=@YACC@ -l

########

INCLUDE=-I. -I$(srcdir)
LIBRARY=@LIBS@

########

programs : @CXREF_CPP@

########

OBJ_FILES=cccp.o cexp.o prefix.o version.o

####

cxref-cpp : $(OBJ_FILES) cxref-cpp.defines
	$(LD) $(LDFLAGS) $(OBJ_FILES) -o $@ $(LIBRARY)
	@touch $@

########

install : programs
	[ ! -f cxref-cpp ] || [ -d $(bindir) ] || $(INSTALL) -d $(bindir)
	[ ! -f cxref-cpp ] || $(INSTALL) -m 755 cxref-cpp $(bindir)
	[ ! -f cxref-cpp ] || $(INSTALL) -m 755 cxref-cpp-configure $(bindir)
	[ ! -f cxref-cpp ] || [ -d $(mandir)/man1 ] || $(INSTALL) -d $(mandir)/man1
	[ ! -f cxref-cpp ] || $(INSTALL) -m 644 $(srcdir)/cxref-cpp.man $(mandir)/man1/cxref-cpp.1
	[ ! -f cxref-cpp ] || $(INSTALL) -m 644 $(srcdir)/cxref-cpp-configure.man $(mandir)/man1/cxref-cpp-configure.1
	[ ! -f cxref-cpp ] || [ -d $(datadir) ] || $(INSTALL) -d $(datadir)
	[ ! -f cxref-cpp ] || $(INSTALL) -m 644 cxref-cpp.defines $(datadir)

install-win32 : programs
	[ ! -f cxref-cpp.exe ] || [ -d $(bindir) ] || $(INSTALL) -d $(bindir)
	[ ! -f cxref-cpp.exe ] || $(INSTALL) -m 755 cxref-cpp.exe $(bindir)
	[ ! -f cxref-cpp.exe ] || $(INSTALL) -m 755 cxref-cpp-configure $(bindir)
	[ ! -f cxref-cpp.exe ] || [ -d $(datadir) ] || $(INSTALL) -d $(datadir)
	[ ! -f cxref-cpp.exe ] || $(INSTALL) -m 644 cxref-cpp.defines $(datadir)

########

clean :
	-rm -f cxref-cpp cxref-cpp.defines core *.o *~

####

distclean : clean
	-rm -f Makefile cxref-cpp-configure autoconfig.h \
	config.log config.status config.cache conftest.gcc

########

cccp.o   : cccp.c config.h pcp.h autoconfig.h
	$(CC) -c -w $(CFLAGS) $< -o $@ $(INCLUDE) -DIN_GCC \
	 '-DCXREF_CPP_DEFINES="$(datadir)/cxref-cpp.defines"'
	@touch $@

cexp.o    : cexp.c config.h autoconfig.h gansidecl.h ansidecl.h system.h libiberty.h intl.h
	$(CC) -c -w $(CFLAGS) $< -o $@ $(INCLUDE) -DIN_GCC
	@touch $@

prefix.o  : prefix.c config.h autoconfig.h gansidecl.h ansidecl.h system.h libiberty.h prefix.h
	$(CC) -c -w $(CFLAGS) $< -o $@ $(INCLUDE) -DIN_GCC -DPREFIX=\"/\"
	@touch $@

version.o : version.c
	$(CC) -c -w $(CFLAGS) $< -o $@ $(INCLUDE) -DIN_GCC
	@touch $@

########

cxref-cpp.defines : cxref-cpp-configure
	./cxref-cpp-configure $(CC) -o $@

########
