#
#   Makefile.fpc for Lazarus for Free Pascal
#

[package]
name=lazarus
version=0.8a

[require]
packages=fcl regexpr

[target]
programs=lazarus
dirs=lcl components
exampledirs=examples

[compiler]
options=-gl
unitdir=lcl/units lcl/units/$(LCL_PLATFORM) designer debugger components/units .
includedir=include include/$(OS_TARGET)
targetdir=.

[clean]
files=$(wildcard ./designer/*$(OEXT)) $(wildcard ./designer/*$(PPUEXT)) $(wildcard ./debugger/*$(OEXT)) $(wildcard ./debugger/*$(PPUEXT))

[install]
basedir=lib/lazarus

[dist]
destdir=$(BASEDIR)/dist

[prerules]
ifndef LCL_PLATFORM
ifeq ($(OS_TARGET), win32)
LCL_PLATFORM=win32
else
LCL_PLATFORM=gtk
endif
export LCL_PLATFORM
endif

export RCPP?=$(strip $(wildcard $(addsuffix /cpp$(SRCEXEEXT), $(SEARCHPATH))))

[rules]
.PHONY: lcl components ide tools all clean
.SUFFIXES: .rc .res

%.res: %.rc
        windres -i $< -o $@ --preprocessor $(RCPP)
#        $(strip $(wildcard $(addsuffix /cpp$(SRCEXEEXT), $(SEARCHPATH))))

ide:
ifeq ($(OS_TARGET), win32)
        $(MAKE) lazarus.res
endif
        $(MAKE) --assume-new=lazarus.pp lazarus$(EXEEXT)

tools: lcl components tools_all

all: lcl components ide

clean: cleanall
        $(DEL) $(wildcard ./designer/*$(OEXT))
        $(DEL) $(wildcard ./designer/*$(PPUEXT))
        $(DEL) $(wildcard ./debugger/*$(OEXT))
        $(DEL) $(wildcard ./debugger/*$(PPUEXT))
ifeq ($(OS_TARGET), win32)
        $(DEL) $(wildcard *.res)
        $(DEL) lazarus.owr
endif
