#
#   $Id: Makefile,v 1.16 1999/08/09 22:20:00 peter Exp $
#   Copyright (c) 1998 by the Free Pascal Development Team
#
#   Makefile for the GTK bindings for Free Pascal
#
#   See the file COPYING.FPC, included in this distribution,
#   for details about the copyright.
#
#   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.
#


#####################################################################
# Defaults
#####################################################################

# Default place of the makefile.fpc
DEFAULTFPCDIR=..

# Where need we to place the executables/ppu/objects
TARGETDIR=.

# As default make only the units
DEFAULTUNITS=1

# default library name
LIBNAME=fpgtk

# Not needed, because we don't link here
#NEEDGCCLIB=1
#NEEDOTHERLIB=1

# When GTK 1.0 is required add the needed define
ifdef GTK10
NEEDOPT=-dGTK10
endif

#####################################################################
# Real targets
#####################################################################

vpath %$(PASEXT) glib gdk gtk

UNITOBJECTS=glib gmodule gdk gtk
EXEOBJECTS=


#####################################################################
# Common targets
#####################################################################

.PHONY: all clean install info \
        staticlib sharedlib libsclean \
        staticinstall sharedinstall libinstall \
        
all: testfpcmake fpc_all

install: testfpcmake fpc_install

info: testfpcmake fpc_info

staticlib: testfpcmake fpc_staticlib

sharedlib: testfpcmake fpc_sharedlib

libsclean: testfpcmake fpc_libsclean

staticinstall: testfpcmake fpc_staticinstall

sharedinstall: testfpcmake fpc_sharedinstall

libinstall: testfpcmake fpc_libinstall


#####################################################################
# Include default makefile
#####################################################################

# test if FPCMAKE is still valid
ifdef FPCMAKE
ifeq ($(strip $(wildcard $(FPCMAKE))),)
FPCDIR=
FPCMAKE=
endif
endif

ifndef FPCDIR
ifdef DEFAULTFPCDIR
FPCDIR=$(DEFAULTFPCDIR)
endif
endif

ifndef FPCMAKE
ifdef FPCDIR
FPCMAKE=$(FPCDIR)/makefile.fpc
else
FPCMAKE=makefile.fpc
endif
endif

override FPCMAKE:=$(strip $(wildcard $(FPCMAKE)))
ifeq ($(FPCMAKE),)
testfpcmake:
	@echo makefile.fpc not found!
	@echo Check the FPCMAKE and FPCDIR environment variables.
	@exit
else
include $(FPCMAKE)
testfpcmake:
endif


#####################################################################
# Dependencies
#####################################################################

clean: testfpcmake fpc_clean
	$(MAKE) -C examples clean
	$(MAKE) -C tutorial clean

glib$(PPUEXT): $(wildcard glib/glib*$(PASEXT))

gmodule$(PPUEXT): $(wildcard glib/gmodule*$(PASEXT)) glib$(PPUEXT)

gdk$(PPUEXT): $(wildcard gdk/gdk*$(PASEXT)) glib$(PPUEXT)

gtk$(PPUEXT): $(wildcard gtk/gtk*$(PASEXT)) gdk$(PPUEXT)

# Examples, tutorial
examples: all
	$(MAKE) -C examples

tutorial: all
	$(MAKE) -C tutorial

#
# $Log: Makefile,v $
# Revision 1.16  1999/08/09 22:20:00  peter
#   * classes vmt changed to only positive addresses
#   * sharedlib creation is working
#
# Revision 1.15  1999/07/26 14:18:18  peter
#   * examples got own makefile
#
# Revision 1.14  1999/07/26 12:08:50  peter
#   + progressbar example
#
# Revision 1.13  1999/07/23 16:08:36  peter
#   * tutorial fixes
#
# Revision 1.12  1999/05/10 19:18:06  peter
#   * more fixes for the examples to work
#
# Revision 1.11  1999/05/10 15:18:41  peter
#   * cdecl fixes
#
# Revision 1.10  1999/05/10 09:02:32  peter
#   * gtk 1.2 port working
#
# Revision 1.9  1999/05/07 15:09:34  peter
#   * more fixes
#
# Revision 1.8  1999/05/07 10:40:16  peter
#   * first things for 1.2
#
# Revision 1.7  1999/04/20 12:40:18  michael
# + Now uses NEEDGCCLIB
#
# Revision 1.6  1999/04/19 09:56:21  michael
# X11 lib paths now set too.
#
# Revision 1.5  1999/04/19 09:50:28  michael
# + Fixed examples target
#
# Revision 1.4  1999/03/16 00:46:59  peter
#   * makefile.fpc targets start with fpc_
#   * small updates for install scripts
#
# Revision 1.3  1999/03/09 01:35:51  peter
#   * makefile.fpc updates and defaultfpcdir var
#
#
