#*************************************************************************
# Copyright (c) 2002 The University of Chicago, as Operator of Argonne
#     National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
#     Operator of Los Alamos National Laboratory.
# EPICS BASE Versions 3.13.7
# and higher are distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution. 
#*************************************************************************

# Author: Jim Kowalkowski
# Date: 9/9/96
#
# $Id$
#

DEPENDS_FLAG = -M # -xM
CCFLAGS = -g -DGDDAUTOPRINT
CXXFLAGS = $(CCFLAGS)
CFLAGS = $(CCFLAGS)
# CCC=purify CC
# CC=purify cc

AR = ar

SRCS = aitGen.c aitTypes.c aitHelpers.cc \
       gdd.cc gddTest.cc gddArray.cc gddContainer.cc \
       gddAppDefs.cc gddAppTable.cc gddNewDel.cc \
       gddErrorCodes.cc gddUtils.cc genApps.cc

MY_OBJS = gdd.o gddTest.o gddAppTable.o gddNewDel.o gddAppDefs.o \
		  aitTypes.o aitConvert.o aitHelpers.o gddArray.o gddContainer.o \
		  gddUtils.o gddErrorCodes.o

LIBOBJS = $(MY_OBJS) dbMapper.o
LIBNAME = libgdd.a

HEADS = gdd.h gddI.h gddContainer.h gddContainerI.h gddArray.h  \
        gddScalar.h gddUtils.h

all: $(LIBNAME) dbMapper.o

$(LIBNAME): $(LIBOBJS)
	$(AR) r $(LIBNAME) $^

# cannot generate dependencies for aitConvert automatically

gdd.o: gdd.cc
gddTest.o: gddTest.cc
gddArray.o: gddArray.cc
gddContainer.o: gddContainer.cc
gddAppTable.o: gddAppTable.cc
gddAppDefs.o: gddAppDefs.cc
gddNewDel.o: gddNewDel.cc
gddUtils.o: gddUtils.cc
gddErrorCodes.o: gddErrorCodes.cc
aitHelpers.o: aitHelpers.cc
aitTypes.o: aitTypes.c
aitConvert.o: aitConvert.cc aitConvert.h aitConvertGenerated.cc aitTypes.h

aitConvertGenerated.cc: aitGen aitTypes.h
	./aitGen

aitGen: aitGen.o aitTypes.o
	$(LINK.c) -o $@ $^ $(LDLIBS)

# cannot generate dependencies for dbMapper.o automatically

dbMapper.o: dbMapper.cc $(HEADS) gddAppTable.h dbMapper.h gddApps.h aitTypes.h
	$(COMPILE.cc) -I$(HOME)/include $<
	$(AR) r $(LIBNAME) $@

gddApps.h: genApps
	./genApps $@

genApps: genApps.o $(MY_OBJS)
	$(LINK.cc) -o $@ $^ $(LDLIBS)

depends:
	-$(COMPILE.cc) $(DEPENDS_FLAG) $(SRCS) >> .DEPENDS

clean:
	/bin/rm -f aitConvertGenerated.cc aitGen genApps *.o *.a

.DEPENDS:
	touch .DEPENDS

include .DEPENDS
