
srcdir = @srcdir@
VPATH = @srcdir@
YACC = @YACC@
LEX = @LEX@
LEXLIB = @LEXLIB@

include ../MakeVars

# The Portland Group compilers don't accept K&R arguments by default
ifneq (,$(findstring pgcc,$(CC)))
CFLAGS += -Xs
endif

CINC += -I$(srcdir)

TARGET = $(top_objdir)/lib/libPSI_ipv1.a

DEFINES += -DNO_TEMPLATES

TRUESRC = ip_alloc.c ip_cwk.c ip_data.c ip_error.c ip_karray.c ip_print.c \
            ip_read.c scan.l parse.y

CSRC = ip_alloc.c ip_cwk.c ip_data.c ip_error.c ip_karray.c ip_print.c ip_read.c
GENSRC = scan.c y.tab.c
ALLSRC = $(CSRC) $(GENSRC)

GBLINC = $(ALLSRC:%.c=%.gbl)

ALLINCLUDE = ip_lib.h ip_error.h ip_types.h ip_global.h tmpl.h $(GBLINC)

LIBOBJ = $(ALLSRC:%.c=%.o)

include ../MakeRules

y.tab.c y.tab.h: parse.y
	$(YACC) -v -d $<

scan.c: scan.l
	$(LEX) -t $^ > scan.c

install_inc:: $(ALLINCLUDE)
	$(MKDIRS) $(incdir)/libipv1
	$(INSTALL_INCLUDE) $^ $(incdir)/libipv1

clean::
	-/bin/rm -f y.tab.h y.tab.c y.output scan.c

depend:: $(ALLINCLUDE) y.tab.h

ifneq ($(DODEPEND),no)
include $(ALLSRC:%.c=%.d)
endif

#
# in case DODEPEND is no
#

ip_read.o:: y.tab.h
