#*******************************************************************************#
#                                                                               #
#  Makefile for FENFORM Vn 2.0                                                  #
#                                                                               #
#  Project Leader - Mike Eggleston                                              #
#                                                                               #
#  Copyright 2005 - 2008 Fenland Software Ltd                                   #
#  Date: 28/08/2008                                                             #
#                                                                               #
#                                                                               #
#*******************************************************************************#
#                                                                               #
#  Licence: GPL Vn2                                                             #
#                                                                               #
#  This program is free software; you can redistribute it and/or modify         #
#  it under the terms of the GNU General Public License as published by         #
#  the Free Software Foundation; either version 2 of the License, or            #
#  (at your option) any later version.                                          #
#                                                                               #
#  This program 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 General Public License for more details.                                 #
#                                                                               #
#  You should have received a copy of the GNU General Public License            #
#  along with this program; if not, write to the Free Software                  #
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    #
#                                                                               #
#                                                                               #
#                                                                               #
#*******************************************************************************#


# Change the following to the name of your ANSI C compiler
# (normally gcc).

CC=gcc

# Compile/load options. Add -DNO_STRERROR to CFLAGS if _strerror
# is undefined

CFLAGS=
LDFLAGS=

# Change the following to the appropriate destination
# directories for system.

PKGDIR=/opt/fenform
BINDIR=$(PKGDIR)/bin


.c.o:
	$(CC) $(CFLAGS) -c $<

all:		build install clean

build:		fenform palette makeform

fenform:	fenform.o fenform_ps.o fenform_cfg.o fenform_bc.o
		$(CC) -o fenform $(LDFLAGS) fenform.o fenform_ps.o fenform_cfg.o fenform_bc.o libbarcode.a pdf417lib.o -lm -lps
		strip fenform

palette:	palette.o
		$(CC) -o palette $(LDFLAGS) palette.o
		strip palette

makeform:	makeform.o fenform_cfg.o
		$(CC) -o makeform $(LDFLAGS) makeform.o fenform_cfg.o -lgs
		strip makeform
		
install:
		chmod 755 fenform
		chown root:bin fenform
		chmod 755 makeform
		chown root:bin makeform
		chmod 755 palette
		chown root:bin palette

		mkdir -p $(DESTDIR)$(BINDIR)
		cp -p fenform $(DESTDIR)$(BINDIR)/fenform-2.0
		cp -p makeform $(DESTDIR)$(BINDIR)/makeform-1.0
		cp -p palette $(DESTDIR)$(BINDIR)/palette
		cp -a ../doc $(DESTDIR)$(PKGDIR)
		cp -a ../etc $(DESTDIR)$(PKGDIR)

		cd $(DESTDIR)$(BINDIR)
		rm -f $(DESTDIR)$(BINDIR)/fenform
		ln -s fenform-2.0 $(DESTDIR)$(BINDIR)/fenform
		rm -f $(DESTDIR)$(BINDIR)/makeform
		ln -s makeform-1.0 $(DESTDIR)$(BINDIR)/makeform

clean:
		rm -f fenform fenform.o fenform_ps.o fenform_cfg.o fenform_bc.o
		rm -f palette palette.o
		rm -f makeform makeform.o

