#
# IBM Omni driver
# Copyright (c) International Business Machines Corp., 2000
#
# This library is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
# the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#

# Stuff you change
DEBUG                 = 1
GENERATEPPDEXE	      =	GeneratePPD
CUPSTOOMNIEXE         = CUPSToOmni
OMNI_INCLUDE_PATH     = -I . -I ..
OMNI_LIB_PATH         = -L ..
OMNI_LIBS             = -lomni -ldl
CUPS_LIB_PATH         = -L cups
CUPS_LIBS             = -lcups -lcupsimage

# Stuff you don't
CC                    = c++
ifdef RETAIL
DEBUG                 =
endif
ifeq "$(windir)" ""
CFLAGS                = -fPIC
else
CFLAGS                =
endif
CFLAGS               += -Wall $(OMNI_INCLUDE_PATH)
ifdef DEBUG
CFLAGS               += -g -DDEBUG=1
endif

.SUFFIXES:
.SUFFIXES: .cpp .hpp .o .exe

.cpp.o:
	$(CC) $(CFLAGS) -c $(*F).cpp

% : %.cpp
	$(CC) $(CFLAGS) -o $(*F) $(OMNI_LIB_PATH) $(OMNI_LIBS) $(CUPS_LIB_PATH) $(CUPS_LIBS) $(*F).cpp

all:	$(GENERATEPPDEXE) $(CUPSTOOMNIEXE)

# dependancies follow
#
# @TBD generate a reverse set of dependancies.  That is, depend.mak depends
#      on the source files and if those files change, then new dependancies
#      need to be made and reloaded
ifeq "$(shell test ! -f depend.mak && echo yes)" "yes"
ifeq  "$(shell $(CC) $(CFLAGS) -M *.cpp > depend.mak)" ""
endif
endif
include depend.mak
