#
# OS2 using EMX 0.9a gcc 2.6.3, and gnumake.
#

EMX_DIR = e:/g/emx
IRIT_DIR = d:/c/irit

#
# Location of object file to resolve circularities in libraries.
#
CIRCLINK = $(IRIT_DIR)/circlink/circlink.o

#
# The scan converter (irender) needs the Utah Raster Toolkit (URT) library
# to read/write image data. You can ftp it in cs.utah.edu.
#
#   Make these empty if you would like to give up on irender's compilation.
#
URT_INC = -Id:/c/urt/include
URT_LIB = d:/c/urt/lib/librle.a
MORE_FLAGS = -DHAVE_URT_RLE

#
# Name of graphics drivers to generate.
#
GRAPDRVS = os2drvs.exe nuldrvs.exe

#
# Generic tools from the unix world
#

RM = rm
CP = cp
MV = mv
STRIP = strip +strip-debug 

#
# All libraries created will be installed into the LIB_DIR directory.
#

LIB_DIR = $(IRIT_DIR)/lib
PRSR_LIB = $(LIB_DIR)/libprsr.a
USER_LIB = $(LIB_DIR)/libuser.a
CAGD_LIB = $(LIB_DIR)/libcagd.a
TRIM_LIB = $(LIB_DIR)/libtrim.a
TRIV_LIB = $(LIB_DIR)/libtriv.a
TRNG_LIB = $(LIB_DIR)/libtrng.a
SYMB_LIB = $(LIB_DIR)/libsymb.a
GEOM_LIB = $(LIB_DIR)/libgeom.a
MISC_LIB = $(LIB_DIR)/libmisc.a
XTRA_LIB = $(LIB_DIR)/libxtra.a
BOOL_LIB = $(LIB_DIR)/libbool.a

#
# Where gcc libraries are to searched for.
#
GCC_LIB_DIR = $(EMX_DIR)/lib
GCC_INC_DIR = $(EMX_DIR)/include

#
# All includes files associated with the libraries compiled here will be
# installed into the INC directory.
#
INC_DIR = $(IRIT_DIR)/include

#
# All binaries created will be installed into the BIN directory.
#
BIN_DIR = $(IRIT_DIR)/os2bin

# Your C compiler and linker.
#
CC = gcc
DFLAGS = -DOS2GCC -DRAND
#CFLAGS = -O2 -W -Wall -I. -I$(INC_DIR)
CFLAGS = -g -W -Wall -I. -I$(INC_DIR) $(URT_INC)

#
# Default rule for compilation.
#
%.o: %.c
	$(CC) -c $(MORE_FLAGS) $(CFLAGS) $(DFLAGS) -o $@ $<

#
# All libraries.
#
LIBS = $(CIRCLINK) $(USER_LIB) $(BOOL_LIB) $(GEOM_LIB) $(PRSR_LIB) \
	$(TRIM_LIB) $(TRIV_LIB) $(TRNG_LIB) $(SYMB_LIB) $(CAGD_LIB) \
	$(MISC_LIB) $(XTRA_LIB) $(URT_LIB) -los2


#
# Binding command and options (see EMX gcc develop.doc file for more).
#
EMXBIND = emxbind
BIND = $(EMXBIND) $(EMX_DIR)/bin/emxl
BINDOPT =

#
# Default rule to make an executable file.
#
%.exe:
	$(CC) $(CFLAGS) -o $(*F) $^ $(LIBS)
	$(STRIP) $(*F)
	$(BIND) $(*F) $(BINDOPT)
	rm $(*F)
