#	Makefile
#
#		This builds the X11R6 version of xt using the YAAF
#	library.

########
#   XT - An example text editor application built with the YAAF library
#   
#   PUBLIC DOMAIN: The source kit of 'xt' has been placed into the
#   public domain by the author, William Edward Woody, on the hope
#   that the source kit will provide a useful example of using the
#   YAAF Library.
#   
#   To contact the author, either e-mail me at woody@pandawave.com, 
#   or write to
#   
#           William Edward Woody
#           In Phase Consulting
#           1545 Ard Eevin Avenue
#           Glendale, CA 91202
#   
#   Or visit us on the web at http://www.pandawave.com

########
#	Makefile commands

all:	XTextEdit XTextEdit_d
	cp XTextEdit /home/woody/bin/xt

clean:
	rm *.o
	rm XTextEdit
	rm XTextEdit_d

cleanlib:
	rm XTextEdit
	rm XTextEdit_d


########
#	Kick off with some interesting defintions
#
#		Define notes:
#
#			OPT_XWIN		Set to 1 to indicate to XConfig.h that
#							we're compiling to X Windows.
#			OPT_NATIVEORDER	Set to 1 if byte order same as network order
#							(Which is true on a 680x0 or MacPPC architecture)
#							Set to 0 if not. (Like under the 80x86)
#			OPT_HASBOOL		Set to 1 if the compiler supports 'bool'
#							Set to 0 will fake bool support

CIncludes	=	-I../../yaaflib/headers

CFlags_d	=	-DOPT_XWIN=1 -DOPT_NATIVEORDER=0 -DOPT_HASBOOL=1 -w -g

CFlags		=	-DOPT_XWIN=1 -DOPT_NATIVEORDER=0 -DOPT_HASBOOL=1 -w

CPPFlags_d	=	-DOPT_XWIN=1 -DOPT_NATIVEORDER=0 -DOPT_HASBOOL=1	\
				-fhandle-exceptions -frtti -w -g 

CPPFlags	=	-DOPT_XWIN=1 -DOPT_NATIVEORDER=0 -DOPT_HASBOOL=1	\
				-fhandle-exceptions -frtti -w

LIncludes	=	-L/usr/X11R6/lib -L../../yaaflib/libs
LFiles		=	-lX11 -lSM -lICE

########
#	Contents

Sources		=	main.o \
				TTextEditApp.o \
				TFile.o \
				TEditCore.o \
				TEditView.o \
				TEditForm.o \
				TEditDoc.o \
				XOpenDialog.o \
				res.o


Sources_d	=	main_d.o \
				TTextEditApp_d.o \
				TFile_d.o \
				TEditCore_d.o \
				TEditView_d.o \
				TEditForm_d.o \
				TEditDoc_d.o \
				XOpenDialog_d.o \
				res_d.o


########
#	And how do I build stuff?

res.cpp: textedit.rdata textedit.rl textedit.bmp
	rcompile textedit.rl res.cpp

%.o: %.c
	gcc -c $(CFlags) $(CIncludes) $< -o $@

%.o: %.cpp
	g++ -c $(CPPFlags) $(CIncludes) $< -o $@

%_d.o: %.c
	gcc -c $(CFlags_d) $(CIncludes) $< -o $@

%_d.o: %.cpp
	g++ -c $(CPPFlags_d) $(CIncludes) $< -o $@


########
#	Build programs

XTextEdit_d:		$(Sources_d)
	g++ -g -o XTextEdit_d $(Sources_d) $(LIncludes) $(LFiles) -lyaaf_d

XTextEdit:		$(Sources)
	g++ -o XTextEdit $(Sources) $(LIncludes) $(LFiles) -lyaaf
