#
# Makefile generated by fpcmake v0.99.15 [2000/07/02]
#

defaultrule: all

#####################################################################
# Autodetect OS (Linux or Dos or Windows NT)
# define inlinux when running under linux
# define inWinNT when running under WinNT
#####################################################################

# We need only / in the path
override PATH:=$(subst \,/,$(PATH))

# Search for PWD and determine also if we are under linux
PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
ifeq ($(PWD),)
PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
ifeq ($(PWD),)
nopwd:
	@echo You need the GNU utils package to use this Makefile!
	@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
	@exit
else
inlinux=1
endif
else
PWD:=$(firstword $(PWD))
endif

# Detect NT - NT sets OS to Windows_NT
ifndef inlinux
ifeq ($(OS),Windows_NT)
inWinNT=1
endif
endif

# Detect OS/2 - OS/2 has OS2_SHELL defined
ifndef inlinux
ifndef inWinNT
ifdef OS2_SHELL
inOS2=1
endif
endif
endif

# The extension of executables
ifdef inlinux
EXEEXT=
else
EXEEXT=.exe
endif

# The path which is searched separated by spaces
ifdef inlinux
SEARCHPATH=$(subst :, ,$(PATH))
else
SEARCHPATH=$(subst ;, ,$(PATH))
endif

# Base dir
ifdef PWD
BASEDIR:=$(shell $(PWD))
else
BASEDIR=.
endif

#####################################################################
# FPC version/target Detection
#####################################################################

# What compiler to use ?
ifndef FPC
# Compatibility with old makefiles
ifdef PP
FPC=$(PP)
else
ifdef inOS2
FPC=ppos2
else
FPC=ppc386
endif
endif
endif
override FPC:=$(subst $(EXEEXT),,$(FPC))
override FPC:=$(subst \,/,$(FPC))$(EXEEXT)

# Target OS
ifndef OS_TARGET
OS_TARGET:=$(shell $(FPC) -iTO)
endif

# Source OS
ifndef OS_SOURCE
OS_SOURCE:=$(shell $(FPC) -iSO)
endif

# Target CPU
ifndef CPU_TARGET
CPU_TARGET:=$(shell $(FPC) -iTP)
endif

# Source CPU
ifndef CPU_SOURCE
CPU_SOURCE:=$(shell $(FPC) -iSP)
endif

# FPC version
ifndef FPC_VERSION
FPC_VERSION:=$(shell $(FPC) -iV)
endif

export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION

#####################################################################
# FPCDIR Setting
#####################################################################

# Test FPCDIR to look if the RTL dir exists
ifdef FPCDIR
override FPCDIR:=$(subst \,/,$(FPCDIR))
ifeq ($(wildcard $(FPCDIR)/rtl),)
ifeq ($(wildcard $(FPCDIR)/units),)
override FPCDIR=wrong
endif
endif
else
override FPCDIR=wrong
endif

# Detect FPCDIR
ifeq ($(FPCDIR),wrong)
ifdef inlinux
override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
ifeq ($(wildcard $(FPCDIR)/units),)
override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
endif
else
override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
override FPCDIR:=$(FPCDIR)/..
ifeq ($(wildcard $(FPCDIR)/rtl),)
ifeq ($(wildcard $(FPCDIR)/units),)
override FPCDIR:=$(FPCDIR)/..
ifeq ($(wildcard $(FPCDIR)/rtl),)
ifeq ($(wildcard $(FPCDIR)/units),)
override FPCDIR=c:/pp
endif
endif
endif
endif
endif
endif

#####################################################################
# User Settings
#####################################################################


# Targets

ifeq ($(OS_TARGET),linux)
override DIROBJECTS+=$(wildcard kcl_gtk)
endif
ifeq ($(OS_TARGET),win32)
override DIROBJECTS+=$(wildcard kcl_gtk kcl_w32)
endif

# Clean


# Install

ZIPTARGET=install

# Defaults


# Directories


# Packages


# Libraries




#####################################################################
# Default Directories
#####################################################################

# set the prefix directory where to install everything
ifndef PREFIXINSTALLDIR
ifdef inlinux
PREFIXINSTALLDIR=/usr
else
PREFIXINSTALLDIR=/pp
endif
endif
export PREFIXINSTALLDIR

# Where to place the resulting zip files
ifndef DESTZIPDIR
DESTZIPDIR:=$(BASEDIR)
endif
export DESTZIPDIR

#####################################################################
# Redirection
#####################################################################

ifndef REDIRFILE
REDIRFILE=log
endif

ifdef REDIR
ifndef inlinux
override FPC=redir -eo $(FPC)
endif
# set the verbosity to max
override FPCOPT+=-va
override REDIR:= >> $(REDIRFILE)
endif

#####################################################################
# Standard rules
#####################################################################

all: $(addsuffix _all,kcl_gtk)

debug: $(addsuffix _debug,kcl_gtk)

smart: $(addsuffix _smart,kcl_gtk)

shared: $(addsuffix _shared,kcl_gtk)

showinstall: $(addsuffix _showinstall,kcl_gtk)

install: $(addsuffix _install,kcl_gtk)

clean: $(addsuffix _clean,kcl_gtk)

distclean: $(addsuffix _distclean,kcl_gtk)

cleanall: $(addsuffix _cleanall,kcl_gtk)

require: $(addsuffix _require,kcl_gtk)

.PHONY:  all debug smart shared showinstall install clean distclean cleanall require

#####################################################################
# Directories
#####################################################################

ifeq ($(OS_TARGET),linux)
OBJECTDIRKCL_GTK=1
endif
ifeq ($(OS_TARGET),win32)
OBJECTDIRKCL_GTK=1
OBJECTDIRKCL_W32=1
endif

# Dir kcl_gtk

ifdef OBJECTDIRKCL_GTK
.PHONY:  kcl_gtk_all kcl_gtk_debug kcl_gtk_examples kcl_gtk_test kcl_gtk_smart kcl_gtk_shared kcl_gtk_showinstall kcl_gtk_install kcl_gtk_sourceinstall kcl_gtk_exampleinstall kcl_gtk_zipinstall kcl_gtk_zipsourceinstall kcl_gtk_zipexampleinstall kcl_gtk_clean kcl_gtk_distclean kcl_gtk_cleanall kcl_gtk_require kcl_gtk_info

kcl_gtk_all:
	$(MAKE) -C kcl_gtk all

kcl_gtk_debug:
	$(MAKE) -C kcl_gtk debug

kcl_gtk_examples:
	$(MAKE) -C kcl_gtk examples

kcl_gtk_test:
	$(MAKE) -C kcl_gtk test

kcl_gtk_smart:
	$(MAKE) -C kcl_gtk smart

kcl_gtk_shared:
	$(MAKE) -C kcl_gtk shared

kcl_gtk_showinstall:
	$(MAKE) -C kcl_gtk showinstall

kcl_gtk_install:
	$(MAKE) -C kcl_gtk install

kcl_gtk_sourceinstall:
	$(MAKE) -C kcl_gtk sourceinstall

kcl_gtk_exampleinstall:
	$(MAKE) -C kcl_gtk exampleinstall

kcl_gtk_zipinstall:
	$(MAKE) -C kcl_gtk zipinstall

kcl_gtk_zipsourceinstall:
	$(MAKE) -C kcl_gtk zipsourceinstall

kcl_gtk_zipexampleinstall:
	$(MAKE) -C kcl_gtk zipexampleinstall

kcl_gtk_clean:
	$(MAKE) -C kcl_gtk clean

kcl_gtk_distclean:
	$(MAKE) -C kcl_gtk distclean

kcl_gtk_cleanall:
	$(MAKE) -C kcl_gtk cleanall

kcl_gtk_require:
	$(MAKE) -C kcl_gtk require

kcl_gtk_info:
	$(MAKE) -C kcl_gtk info
endif

# Dir kcl_w32

ifdef OBJECTDIRKCL_W32
.PHONY:  kcl_w32_all kcl_w32_debug kcl_w32_examples kcl_w32_test kcl_w32_smart kcl_w32_shared kcl_w32_showinstall kcl_w32_install kcl_w32_sourceinstall kcl_w32_exampleinstall kcl_w32_zipinstall kcl_w32_zipsourceinstall kcl_w32_zipexampleinstall kcl_w32_clean kcl_w32_distclean kcl_w32_cleanall kcl_w32_require kcl_w32_info

kcl_w32_all:
	$(MAKE) -C kcl_w32 all

kcl_w32_debug:
	$(MAKE) -C kcl_w32 debug

kcl_w32_examples:
	$(MAKE) -C kcl_w32 examples

kcl_w32_test:
	$(MAKE) -C kcl_w32 test

kcl_w32_smart:
	$(MAKE) -C kcl_w32 smart

kcl_w32_shared:
	$(MAKE) -C kcl_w32 shared

kcl_w32_showinstall:
	$(MAKE) -C kcl_w32 showinstall

kcl_w32_install:
	$(MAKE) -C kcl_w32 install

kcl_w32_sourceinstall:
	$(MAKE) -C kcl_w32 sourceinstall

kcl_w32_exampleinstall:
	$(MAKE) -C kcl_w32 exampleinstall

kcl_w32_zipinstall:
	$(MAKE) -C kcl_w32 zipinstall

kcl_w32_zipsourceinstall:
	$(MAKE) -C kcl_w32 zipsourceinstall

kcl_w32_zipexampleinstall:
	$(MAKE) -C kcl_w32 zipexampleinstall

kcl_w32_clean:
	$(MAKE) -C kcl_w32 clean

kcl_w32_distclean:
	$(MAKE) -C kcl_w32 distclean

kcl_w32_cleanall:
	$(MAKE) -C kcl_w32 cleanall

kcl_w32_require:
	$(MAKE) -C kcl_w32 require

kcl_w32_info:
	$(MAKE) -C kcl_w32 info
endif

#####################################################################
# Local Makefile
#####################################################################

ifneq ($(wildcard fpcmake.loc),)
include fpcmake.loc
endif

