#
#   $Id: Makefile,v 1.11 1999/07/23 08:15:36 michael Exp $
#   Copyright (c) 1998 by the Free Pascal Development Team
#
#   Makefile for Lowlevel API 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 are the files located
OSINC=$(OS_TARGET)

# Add this dir also to the path as first
NEEDUNITDIR=$(OS_TARGET)

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

# As default make only the units
DEFAULTUNITS=1


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

# Override defaults
override LIBNAME=api
override PASEXT=.pas

vpath %$(PASEXT) $(OSINC) test

include test/makefile.api

UNITOBJECTS=common callspec video keyboard mouse filectrl filesys
EXEOBJECTS=$(TESTOBJECTS)

EXTRAINSTALLUNITS=terminfo event
EXTRACLEANUNITS=terminfo event

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

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

clean: testfpcmake fpc_clean

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
#####################################################################

video$(PPUEXT): video.pas $(OSINC)/video.inc

ifeq ($(OS_TARGET),win32)
keyboard$(PPUEXT): keyboard.pas $(OSINC)/keyboard.inc event$(PPUEXT)
else
keyboard$(PPUEXT): keyboard.pas $(OSINC)/keyboard.inc
endif


ifeq ($(OS_TARGET),win32)
mouse$(PPUEXT): mouse.pas $(OSINC)/mouse.inc event$(PPUEXT)
else
mouse$(PPUEXT): mouse.pas $(OSINC)/mouse.inc
endif

filectrl$(PPUEXT): filectrl.pas $(OSINC)/filectrl.inc

# Allow test as target which compiles the exes
test: fpc_exes

#
# $Log: Makefile,v $
# Revision 1.11  1999/07/23 08:15:36  michael
# + Fixed wrong line endings
#
# Revision 1.10  1999/07/22 16:15:15  peter
#   * install,clean fixes
#
# Revision 1.9  1999/07/16 13:45:23  peter
#   * 0.99.12b updates
#   * merges
#
# Revision 1.8  1999/07/14 08:45:14  florian
#   * commited a new keyboard by Armin Diehl
#   * fixed event handling, mainly the prototype of eventhandlethread was wrong
#
# Revision 1.7  1999/07/05 21:37:03  peter
#   * clean terminfo unit also for linux
#
# Revision 1.6  1999/03/16 00:46:53  peter
#   * makefile.fpc targets start with fpc_
#   * small updates for install scripts
#
# Revision 1.5  1999/03/09 01:35:45  peter
#   * makefile.fpc updates and defaultfpcdir var
#
#
