mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-21 03:41:27 +02:00
280 lines
5.2 KiB
Makefile
280 lines
5.2 KiB
Makefile
#
|
|
# Makefile generated by fpcmake v0.99.13 [2000/01/10]
|
|
#
|
|
|
|
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
|
|
|
|
# echo
|
|
ifndef ECHO
|
|
ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
|
|
ifeq ($(ECHO),)
|
|
ECHO:=echo
|
|
else
|
|
ECHO:=$(firstword $(ECHO))
|
|
endif
|
|
endif
|
|
export ECHO
|
|
|
|
# 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$(EXEEXT)
|
|
else
|
|
FPC=ppc386$(EXEEXT)
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
# 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),)
|
|
override FPCDIR=wrong
|
|
endif
|
|
else
|
|
override FPCDIR=wrong
|
|
endif
|
|
|
|
# Detect FPCDIR
|
|
ifeq ($(FPCDIR),wrong)
|
|
ifdef inlinux
|
|
override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
|
|
else
|
|
override FPCDIR:=$(subst /$(FPC)$(EXEEXT),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC)$(EXEEXT),$(SEARCHPATH))))))
|
|
endif
|
|
endif
|
|
|
|
ifndef PACKAGESDIR
|
|
PACKAGESDIR=$(FPCDIR)/packages
|
|
endif
|
|
ifndef TOOLKITSDIR
|
|
TOOLKITSDIR=
|
|
endif
|
|
ifndef COMPONENTSDIR
|
|
COMPONENTSDIR=
|
|
endif
|
|
# Create units dir
|
|
ifneq ($(FPCDIR),.)
|
|
UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
|
|
endif
|
|
|
|
#####################################################################
|
|
# User Settings
|
|
#####################################################################
|
|
|
|
|
|
# Targets
|
|
|
|
|
|
# Clean
|
|
|
|
|
|
# Install
|
|
|
|
ZIPTARGET=install
|
|
|
|
# Defaults
|
|
|
|
|
|
# Directories
|
|
|
|
|
|
# Packages
|
|
|
|
override PACKAGES+=rtl
|
|
|
|
# Libraries
|
|
|
|
|
|
|
|
# Package/component dirs
|
|
|
|
# Check if the dirs really exists, else turn it off
|
|
ifeq ($(wildcard $(UNITSDIR)),)
|
|
UNITSDIR=
|
|
endif
|
|
ifeq ($(wildcard $(TOOLKITSDIR)),)
|
|
TOOLKITSDIR=
|
|
endif
|
|
ifeq ($(wildcard $(PACKAGESDIR)),)
|
|
PACKAGESDIR=
|
|
endif
|
|
ifeq ($(wildcard $(COMPONENTSDIR)),)
|
|
COMPONENTSDIR=
|
|
endif
|
|
|
|
ifneq ($(wildcard $(FPCDIR)/rtl),)
|
|
ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),)
|
|
PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET)
|
|
else
|
|
PACKAGEDIR_RTL=$(FPCDIR)/rtl
|
|
endif
|
|
UNITDIR_RTL=$(PACKAGEDIR_RTL)
|
|
else
|
|
PACKAGEDIR_RTL=
|
|
ifneq ($(wildcard $(UNITSDIR)/rtl),)
|
|
ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),)
|
|
UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET)
|
|
else
|
|
UNITDIR_RTL=$(UNITSDIR)/rtl
|
|
endif
|
|
else
|
|
UNITDIR_RTL=
|
|
endif
|
|
endif
|
|
ifdef UNITDIR_RTL
|
|
override NEEDUNITDIR+=$(UNITDIR_RTL)
|
|
endif
|
|
|
|
#####################################################################
|
|
# Redirection
|
|
#####################################################################
|
|
|
|
# Release ? Then force OPT and don't use extra opts via commandline
|
|
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
|
|
#####################################################################
|
|
|
|
|
|
PACKAGERTL=1
|
|
ifdef PACKAGERTL
|
|
ifneq ($(wildcard $(PACKAGEDIR_RTL)),)
|
|
ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),)
|
|
override COMPILEPACKAGES+=rtl
|
|
rtl_package:
|
|
$(MAKE) -C $(PACKAGEDIR_RTL) all
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
.PHONY: rtl_package
|
|
|
|
#####################################################################
|
|
# Local Makefile
|
|
#####################################################################
|
|
|
|
ifneq ($(wildcard fpcmake.loc),)
|
|
include fpcmake.loc
|
|
endif
|
|
|
|
#####################################################################
|
|
# Users rules
|
|
#####################################################################
|
|
|
|
all:
|
|
$(MAKE) -C $(OS_TARGET) all
|