# $Header$

# C compilation part. Not to be called directly.
# Instead, it is to be called by the Makefile.
# SRC_DIR, UTIL_HOME, TARGET_HOME, CC, COPTIONS, LINT, LINTOPTIONS, LDOPTIONS,
# CC_AND_MKDEP, SUF, LIBSUF should be set here.

#PARAMS		do not remove this line!

MDIR =		$(TARGET_HOME)/modules
LIBDIR =	$(MDIR)/lib
LINTLIBDIR =	$(UTIL_HOME)/modules/lib

MALLOC =	$(LIBDIR)/malloc.$(SUF)

MODLIB = \
		$(LIBDIR)/libassert.$(LIBSUF) \
		$(LIBDIR)/liballoc.$(LIBSUF) \
		$(LIBDIR)/libobject.$(LIBSUF) \
		$(MALLOC) \
		$(LIBDIR)/libprint.$(LIBSUF) \
		$(LIBDIR)/libstring.$(LIBSUF) \
		$(LIBDIR)/libsystem.$(LIBSUF)

LIBS =		$(EXTRALIB) $(MODLIB)

LINTLIBS = \
		$(LINTLIBDIR)/$(LINTPREF)assert.$(LINTSUF) \
		$(LINTLIBDIR)/$(LINTPREF)alloc.$(LINTSUF) \
		$(LINTLIBDIR)/$(LINTPREF)print.$(LINTSUF) \
		$(LINTLIBDIR)/$(LINTPREF)string.$(LINTSUF) \
		$(LINTLIBDIR)/$(LINTPREF)system.$(LINTSUF)

PROFILE =
INCLUDES =	-I. -I$(SRC_DIR) -I$(TARGET_HOME)/modules/h -I$(TARGET_HOME)/h -I$(TARGET_HOME)/modules/pkg
CFLAGS =	$(PROFILE) $(INCLUDES) $(COPTIONS) -DNDEBUG
LINTFLAGS =	$(INCLUDES) $(LINTOPTIONS)
LDFLAGS =	$(PROFILE) $(LDOPTIONS)

# C_SRC and OBJ should be set here.
#LISTS		do not remove this line!

all:		grind

clean:
		rm -f *.$(SUF) grind

lint:
		$(LINT) $(LINTFLAGS) $(C_SRC) $(LINTLIBS)

grind:		$(OBJ)
		$(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o grind

# do not remove the next line; it is used for generating dependencies
#DEPENDENCIES
