#  Makefile for the OS/2 version of units

#  Peter Weilbacher (os2@Weilbacher.org), 25Jan2003.

#

#  Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc

#

#  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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA


CC=gcc
CFLAGS=-Zomf
LFLAGS=-Zlinker /PM:VIO -Zlinker /E:2 -Lf:\P\emx\lib -Lf:\P\emx\lib\st -lm -lreadline -ltermcap
O=.o

NAME=units
READLINE=-DREADLINE
OBJECTS=$(NAME)$O getopt$O getopt1$O strfunc$O parse.tab$O # ansi2knr$O

EXE=$(NAME).exe
DOC=$(NAME).doc
MAN=$(NAME).man
SRCFILES=ChangeLog INSTALL Makefile.dos Makefile.in aclocal.m4 \
	ansi2knr.1 ansi2knr.c configure configure.in getopt.c getopt.h \
	getopt1.c install-sh mkinstalldirs strfunc.c texi2man units.c \
	units.texinfo \
	Makefile.OS2
DISTFILES=COPYING README NEWS units.dat \
	ReadMe.OS2 makeobjs.cmd \
	$(EXE) $(DOC) $(NAME).less

.SUFFIXES: .c $O

.c$O:	
	$(CC) $(CFLAGS) $(READLINE) -c $<

all:	$(EXE) $(DOC)

$(EXE): $(OBJECTS)
	$(CC) $(CFLAGS) $(LFLAGS) $(READLINE) $(OBJECTS) -o $@

$(DOC):	$(NAME).texinfo texi2man
	perl .\texi2man $(NAME).texinfo > $(MAN)
	sed s!@DATAFILE@!units.dat! $(NAME).man > $(NAME).1
	groff -man $(NAME).1 > $(NAME).less
#	col -b $(NAME).less > $(DOC)

	sed -e "s/_//g" -e "s/.//g" units.less > units.doc

dist:	all
	@mkdir dist
	@cp -f $(DISTFILES) dist
	@zip -9rSq dist\units-src.zip $(SRCFILES)
	@rm -f $(OBJECTS)

check:	$(EXE)
	@echo Checking $(EXE)
	@echo If output is "* 25.4" the program should be OK
	@$(EXE) -f .\units.dat kiloinch meter | grep "\*"
	@echo End check

clean:	
	rm -f $(OBJECTS) $(EXE) $(MAN) $(NAME).1 $(NAME).less $(DOC)
	rm -rf dist


syntax highlighted by Code2HTML, v. 0.9.1