# $Id: Makefile.in,v 4.36 2021/03/03 23:53:08 tom Exp $
#
# UNIX template-makefile for C prototype generator

THIS = cproto
RELEASE = 4_7s

#### Start of system configuration section. ####

srcdir = @srcdir@
VPATH  = @srcdir@

CC		= @CC@
CPP		= @CPP@
LEX		= @LEX@
YACC		= @YACC@
LINT		= @LINT@
CTAGS		= @CTAGS@

INSTALL		= @INSTALL@
INSTALL_PROGRAM	= @INSTALL_PROGRAM@
INSTALL_DATA	= @INSTALL_DATA@

DEFINES		=
EXTRA_CFLAGS	= @EXTRA_CFLAGS@
CPPFLAGS	= -I. -I$(srcdir) $(DEFINES) -DHAVE_CONFIG_H @CPPFLAGS@
CFLAGS		= @CFLAGS@ $(EXTRA_CFLAGS)
LIBS		= @LIBS@ @LEXLIB@

prefix		= @prefix@
exec_prefix	= @exec_prefix@
datarootdir	= @datarootdir@

bindir		= @bindir@
mandir		= @mandir@
manext		= 1

BINDIR		= $(DESTDIR)$(bindir)
MANDIR		= $(DESTDIR)$(mandir)/man$(manext)

x		= @EXEEXT@
o		= .@OBJEXT@

.SUFFIXES:	.c $o .i

TEST_REF	= .

#### End of system configuration section. ####

SHELL		= @THIS_SHELL@
@SET_MAKE@

PROG		= $(THIS)$x

LDFLAGS		= @LDFLAGS@

DOC_FILES = \
	README \
	CHANGES \
	$(THIS).1

MAK_FILES = \
	Makefile.in \
	configure.in \
	aclocal.m4 \
	config_h.in

H_FILES = \
	yyerror.c \
	system.h \
	$(THIS).h \
	semantic.h \
	symbol.h

C_FILES = \
	$(THIS).c \
	lintlibs.c \
	semantic.c \
	strkey.c \
	symbol.c

AUX_FILES = \
	lex.l \
	grammar.y

JUNK =	\
	lex.yy.c \
	y.tab.c

EXTRA_OBJS = @EXTRA_OBJS@
OBJECTS = $(THIS)$o lintlibs$o semantic$o strkey$o symbol$o y.tab$o \
	$(EXTRA_OBJS)
SOURCES = $(DOC_FILES) $(MAK_FILES) $(H_FILES) $(C_FILES) $(AUX_FILES)

all : $(PROG) # $(THIS).man

install: all installdirs
	$(INSTALL_PROGRAM) $(PROG) $(BINDIR)/$(PROG)
	- $(INSTALL_DATA) $(srcdir)/$(THIS).1 $(MANDIR)/$(THIS).$(manext)

installdirs:
	mkdir -p $(BINDIR)
	- mkdir -p $(MANDIR)

uninstall:
	- rm -f $(BINDIR)/$(PROG) $(MANDIR)/$(THIS).$(manext)

.c$o:
	@RULE_CC@
	@ECHO_CC@$(CC) -c $(CFLAGS) $(CPPFLAGS) $<

.c.i:
	@RULE_CC@
	@ECHO_CC@$(CPP) $(CPPFLAGS) $< >$*.i

$(PROG) : $(OBJECTS)
	@ECHO_LD@$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS)

y.tab.c : grammar.y
	$(YACC) $(srcdir)/grammar.y

lex.yy.c : lex.l
	$(LEX) $(srcdir)/lex.l

mostlyclean ::
	- rm -f core .nfs* *$o *.i *.bak *.BAK *.out $(JUNK) default.h

clean :: mostlyclean
	- rm -f $(PROG)
	- cd $(srcdir)/testing && $(MAKE) $@

distclean :: clean
	- rm -f config.log config.cache config.status config.h Makefile man2html.tmp
	- rm -f .version .fname
	- cd $(srcdir)/testing && $(MAKE) $@

realclean :: distclean
	- rm -f tags
	- cd $(srcdir)/testing && $(MAKE) $@

check \
check_errors:	$(PROG)
	cd $(srcdir)/testing && $(MAKE) $@ TEST_REF="$(TEST_REF)" SHELL="$(SHELL)"

default.h: $(C_FILES) lex.yy.c
	./$(PROG) -e -v -m -M ARGS -d $(DEFINES) $(C_FILES) grammar.y >$@

getopt.o : $(srcdir)/porting/getopt.c
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/porting/getopt.c

popen.o : $(srcdir)/porting/popen.c
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/porting/popen.c

lint: $(C_FILES) $(JUNK)
	$(LINT) $(CPPFLAGS) $(C_FILES) y.tab.c >$@.out

llib: $(C_FILES) $(JUNK)
	./$(PROG) -l $(CPPFLAGS) $(C_FILES) y.tab.c >$@.out

self: $(C_FILES) $(JUNK)
	./$(PROG) $(CPPFLAGS) $(C_FILES) y.tab.c >$@.out

tags: $(H_FILES) $(C_FILES) $(AUX_FILES)
	$(CTAGS) $(C_FILES) $(AUX_FILES) $(H_FILES)

depend:
	makedepend -- $(CPPFLAGS) -- $(C_FILES) y.tab.c

# DO NOT DELETE THIS LINE -- make depend depends on it.

cproto$o   : cproto.h config.h system.h
lintlibs$o : cproto.h config.h system.h semantic.h symbol.h
semantic$o : cproto.h config.h system.h semantic.h
strkey$o   : cproto.h config.h system.h 
symbol$o   : cproto.h config.h system.h symbol.h
y.tab$o	   : cproto.h config.h system.h symbol.h semantic.h lex.yy.c yyerror.c
