#
# This is "The Simple Makefile" for the ButtonFace Library
# (c) 1994 Harald Albrecht, albrecht@igpm.rwth-aachen.de
#
# Since Imake is a rubbish when using ANSI C sources I'll provide this
# simple Makefile. Please edit it accordingly to your suits.
#
# - Start of local definitions ---------------------------------------------------
#
# FIRST: options for tailoring the ButtonFace Library
#
# Do you want to use PushButtonGadgets and LabelGadgets? If you don't need them
# at all then comment out the next line.
GADGETOPT	= -DUSEGADGETS

#
# SECOND: options and paths...
#
# This is the name of your favourite (ANSI) C compiler together with the command 
# line option for switching it into ANSI mode.
# Some possible invocations....
# SGI: cc -xansi
# SUN: *&#^$ --no-ansi-C-available-from-sun
# others: ???
# The next one should work on many platforms!
CCOMP		= gcc -ansi

# These are the necessary options for compiling
CC_OPTS		= -DFUNCPROTO -g

# There you've put the XPM include and lib to
INCLUDE_XPM	= -I/usr/X11/include/X11
LIB_XPM		= -L../xpm

# How to create a library
AR		= ar -cq
# how to index it
RANLIB		= ranlib

#
# - End of local definitions -----------------------------------------------------
# Do not edit the Makefile below this line!
#
INCLUDEPATHS	= -I. $(INCLUDE_XPM)
LIBPATHS        = -L. $(LIB_XPM)
CC		= $(CCOMP) $(CC_OPTS) $(INCLUDEPATHS)

LIBOBJECTS	= pushbuttons.o msgbox.o resource.o Center.o

# --------------------------------------------------------------------------------
# make rules...
#
demo:		demo.o libButtFace.a
		$(CC) -o demo demo.o $(LIBPATHS) \
			-lButtFace -lXpm -lXm -lXmu -lXt -lX11
		
demo.o:		demo.c pushbuttons.h
		$(CC) -g -DFUNCPROTO -I. -I../xpm -c demo.c

#
# the demos from the doc...
#
xhello1:	xhello1.o libButtFace.a
		$(CC) -o xhello1 xhello1.o $(LIBPATHS) \
			-lButtFace -lXpm -lXm -lXmu -lXt -lX11

xhello1.o:	xhello1.c
		$(CC) -DFUNCPROTO -c xhello1.c

xhello2:	xhello2.o libButtFace.a
		$(CC) -o xhello2 xhello2.o $(LIBPATHS) \
			-lButtFace -lXpm -lXm -lXmu -lXt -lX11

xhello2.o:	xhello2.c QuitPB.xpm QuitPBa.xpm
		$(CC) -DFUNCPROTO -c xhello2.c

xhello3:	xhello3.o libButtFace.a
		$(CC) -o xhello3 xhello3.o $(LIBPATHS) \
			-lButtFace -lXpm -lXm -lXmu -lXt -lX11

xhello3.o:	xhello3.c QuitPB.xpm QuitPBa.xpm
		$(CC) -DFUNCPROTO -c xhello3.c

xhello4:	xhello4.o libButtFace.a
		$(CC) -o xhello4 xhello4.o $(LIBPATHS) \
			-lButtFace -lXpm -lXm -lXmu -lXt -lX11

xhello4.o:	xhello4.c QuitPB.xpm QuitPBa.xpm
		$(CC) -DFUNCPROTO -c xhello4.c


#
# run "make I18N" if you want to play with an internationalized demo...
#
I18N:		./pixmaps/ger/Demo.ad
		@true

#
# Compile simple AppResourceFile (localized)
#
./pixmaps/ger/Demo.ad:
		@echo "Localizing for Germany..."
		@echo "*.title1: Wichtige Hilfe..." >> ./pixmaps/ger/Demo.ad
		@echo "*.question1: Bitte haben Sie einen Moment Geduld,\\\\nw\\\\344hrend ich die Anwort auf\\\\ndie Frage nach dem Leben, dem\\\\nUniversum und dem Rest suche." >> ./pixmaps/ger/Demo.ad
		@echo "*.title3: Die Antwort!" >> ./pixmaps/ger/Demo.ad
		@echo "*.answer1: Die Antwort ist 42!" >> ./pixmaps/ger/Demo.ad
		@echo "*.title2: Schon aufh\\\\366ren?" >> ./pixmaps/ger/Demo.ad
		@echo "*.question2: Wollen Sie wirklich dieses\\\\nphantastische Programm beenden?" >> ./pixmaps/ger/Demo.ad
		@./xpm2rsc ./pixmaps/ger/OkayPB.xpm    ./pixmaps/ger/Demo.ad \*.ok.normalFace
		@./xpm2rsc ./pixmaps/ger/OkayPBa.xpm   ./pixmaps/ger/Demo.ad \*.ok.armedFace
		@./xpm2rsc ./pixmaps/ger/CancelPB.xpm  ./pixmaps/ger/Demo.ad \*.cancel.normalFace
		@./xpm2rsc ./pixmaps/ger/CancelPBa.xpm ./pixmaps/ger/Demo.ad \*.cancel.armedFace
		@./xpm2rsc ./pixmaps/ger/AbortPB.xpm   ./pixmaps/ger/Demo.ad \*.abort.normalFace
		@./xpm2rsc ./pixmaps/ger/AbortPBa.xpm  ./pixmaps/ger/Demo.ad \*.abort.armedFace
		@./xpm2rsc ./pixmaps/ger/RetryPB.xpm   ./pixmaps/ger/Demo.ad \*.retry.normalFace
		@./xpm2rsc ./pixmaps/ger/RetryPBa.xpm  ./pixmaps/ger/Demo.ad \*.retry.armedFace
		@./xpm2rsc ./pixmaps/ger/IgnorePB.xpm  ./pixmaps/ger/Demo.ad \*.ignore.normalFace
		@./xpm2rsc ./pixmaps/ger/IgnorePBa.xpm ./pixmaps/ger/Demo.ad \*.ignore.armedFace
		@./xpm2rsc ./pixmaps/ger/YesPB.xpm     ./pixmaps/ger/Demo.ad \*.yes.normalFace
		@./xpm2rsc ./pixmaps/ger/YesPBa.xpm    ./pixmaps/ger/Demo.ad \*.yes.armedFace
		@./xpm2rsc ./pixmaps/ger/NoPB.xpm      ./pixmaps/ger/Demo.ad \*.no.normalFace
		@./xpm2rsc ./pixmaps/ger/NoPBa.xpm     ./pixmaps/ger/Demo.ad \*.no.armedFace
		@./xpm2rsc ./pixmaps/ger/HelpPB.xpm    ./pixmaps/ger/Demo.ad \*.help.normalFace
		@./xpm2rsc ./pixmaps/ger/HelpPBa.xpm   ./pixmaps/ger/Demo.ad \*.help.armedFace
		@echo "run german demo with:"
		@echo "XENVIRONMENT=./pixmaps/ger/Demo.ad; export XENVIRONMENT; ./demo; unset XENVIRONMENT"

#
# The ButtonFace Library itself.
#
libButtFace.a:	$(LIBOBJECTS)
		-rm libButtFace.a
		$(AR) libButtFace.a $(LIBOBJECTS)
		$(RANLIB) libButtFace.a
#
# PushButtons & Labels with pixmaps
#
pushbuttons.o:	pushbuttons.c pushbuttons.h
		$(CC) $(GADGETOPT) -I./pixmaps/eng -c pushbuttons.c
#
# MessageBoxes
#
msgbox.o:	msgbox.c msgbox.h pushbuttons.h Center.h
		$(CC) -c msgbox.c
#
# Access of entries in the resource database
#
resource.o:	resource.c resource.h
		$(CC) -c resource.c
#
# center widgets in a row or column within this manager widget
#
Center.o:	Center.c Center.h CenterP.h
		$(CC) -c Center.c
		

# --------------------------------------------------------------------------------
# clean up any unneeded files
#
clean:
		@-rm core a.out *.o *.a xhello1 xhello2 xhello3 xhello4 \
			demo *.gz *.aux *.dvi *.log *.lof *.lot *.toc *.tar *.bak

# --------------------------------------------------------------------------------
# put altogether into tar file
#
tar:
		@tar cvf ButtonFaceLib.tar \
			pushbuttons.c pushbuttons.h \
			resource.c resource.h \
			msgbox.c msgbox.h \
			Center.c CenterP.h Center.h \
			xpm2rsc \
			./pixmaps/eng/*.xpm \
			./pixmaps/ger/*.xpm \
			*.gif Makefile demo.c \
			*.tex *.sty *.doc COPYING \
			xhello1.c xhello2.c xhello3.c xhello4.c \
			QuitPB.xpm QuitPBa.xpm
		@gzip -f ButtonFaceLib.tar
		@ls -l ButtonFaceLib.tar.gz

publictar:
		latex ButtonFaceLib.tex
		latex ButtonFaceLib.tex
		/usr/local/bin/dvips.exe -t DINA4 -o ButtonFaceLib.ps ButtonFaceLib.dvi
		tar cvf ButtonFaceLib.tar \
			pushbuttons.c pushbuttons.h \
			resource.c resource.h \
			msgbox.c msgbox.h \
			Center.c CenterP.h Center.h \
			xpm2rsc \
			./pixmaps/eng/*.xpm \
			./pixmaps/ger/*.xpm \
			Makefile demo.c *.dvi *.doc COPYING \
			xhello1.c xhello2.c xhello3.c xhello4.c \
			QuitPB.xpm QuitPBa.xpm
		gzip -f ButtonFaceLib.tar
		gzip -f ButtonFaceLib.ps

# End of Makefile
