#
# OS2 using EMX 0.8f gcc 2.0, and gnumake.
#

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

#
# 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
CAGD_LIB = $(LIB_DIR)/libcagd.a
GEOM_LIB = $(LIB_DIR)/libgeom.a
MISC_LIB = $(LIB_DIR)/libmisc.a
GIF_LIB = d:/c/gif_lib/lib/libgif.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)/inc
GIF_INC = d:/c/gif_lib/lib

#
# All binaries created will be installed into the BIN directory.
#
BIN_DIR = d:/c/irit/bin

# Your C compiler and linker.
#
# -DSUPPORT_GIF_SAVE if you actually have gif lib and would like poly3d to
# save gif images.
#
CC = gcc
DFLAGS = -DOS2GCC -DSUPPORT_GIF_SAVE -DRAND
#CFLAGS = -O2 -W -Wall -I. -I$(INC_DIR)
CFLAGS = -g -W -Wall -I. -I$(INC_DIR) -I$(GIF_INC)

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

#
# All libraries.
#
LIBS = $(GEOM_LIB) $(PRSR_LIB) $(CAGD_LIB) $(MISC_LIB) $(GIF_LIB) -los2


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

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