# $Id$

# 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, MACH 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)

EMLIB =		$(LIBDIR)/libem_mesO.$(LIBSUF) \
		$(LIBDIR)/libCEopt.$(LIBSUF) \
		$(TARGET_HOME)/lib.bin/$(MACH)/ce.$(LIBSUF) \
		$(TARGET_HOME)/lib.bin/$(MACH)/back.$(LIBSUF) \
		$(TARGET_HOME)/lib.bin/em_data.$(LIBSUF) \
		$(LIBDIR)/libobject.$(LIBSUF)

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

LIBS =		$(EMLIB) $(MODLIB)

LINTLIBS =	$(LINTLIBDIR)/$(LINTPREF)em_mes.$(LINTSUF) \
		$(LINTLIBDIR)/$(LINTPREF)emk.$(LINTSUF) \
		$(LINTLIBDIR)/$(LINTPREF)input.$(LINTSUF) \
		$(LINTLIBDIR)/$(LINTPREF)assert.$(LINTSUF) \
		$(LINTLIBDIR)/$(LINTPREF)alloc.$(LINTSUF) \
		$(LINTLIBDIR)/$(LINTPREF)flt.$(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)
LINTFLAGS =	$(INCLUDES) $(LINTOPTIONS)
LDFLAGS =	$(PROFILE) $(LDOPTIONS)

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

all:		main

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

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

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

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