pas2js/Makefile.fpc
2017-12-28 10:01:55 +00:00

156 lines
5.5 KiB
Makefile

#
# Makefile.fpc for running fpmake
#
[package]
name=pas2js
version=3.1.1
[install]
fpcpackage=n
[default]
fpcdir=../../fpc
[prerules]
FPMAKE_BIN_CLEAN=$(wildcard ./fpmake$(SRCEXEEXT))
ifdef OS_TARGET
FPC_TARGETOPT+=--os=$(OS_TARGET)
endif
ifdef CPU_TARGET
FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
endif
LOCALFPMAKE=./fpmake$(SRCEXEEXT)
[rules]
# Do not pass the Makefile's unit and binary target locations. Fpmake uses it's own.
override FPCOPT:=$(filter-out -FU%,$(FPCOPT))
override FPCOPT:=$(filter-out -FE%,$(FPCOPT))
# Do not pass the package-unitdirectories. Fpmake adds those and this way they don't apear in the .fpm
override FPCOPT:=$(filter-out $(addprefix -Fu,$(COMPILER_UNITDIR)),$(FPCOPT))# Compose general fpmake-parameters
# Compose general fpmake-parameters
ifdef FPMAKEOPT
FPMAKE_OPT+=$(FPMAKEOPT)
endif
FPMAKE_OPT+=--localunitdir=../..
FPMAKE_OPT+=--globalunitdir=../../packages
FPMAKE_OPT+=$(FPC_TARGETOPT)
FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT))
FPMAKE_OPT+=--compiler=$(FPC)
FPMAKE_OPT+=-bu
.NOTPARALLEL:
fpmake$(SRCEXEEXT): fpmake.pp
$(FPCFPMAKE) fpmake.pp $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
all: fpmake$(SRCEXEEXT)
$(LOCALFPMAKE) compile $(FPMAKE_OPT)
smart: fpmake$(SRCEXEEXT)
$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
release: fpmake$(SRCEXEEXT)
$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
debug: fpmake$(SRCEXEEXT)
$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
# If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
# most often fail because the dependencies are cleared.
# In case of a clean, simply do nothing
ifeq ($(FPMAKE_BIN_CLEAN),)
clean:
else
clean:
$(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
endif
# In case of a distclean, perform an 'old'-style distclean. This to avoid problems
# when the package is compiled using fpcmake prior to running this clean using fpmake
ifeq ($(FPMAKE_BIN_CLEAN),)
distclean: $(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
else
distclean:
ifdef inUnix
{ $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi; }
else
$(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
endif
-$(DEL) $(LOCALFPMAKE)
endif
cleanall: distclean
install: fpmake$(SRCEXEEXT)
ifdef UNIXHier
$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR)
else
$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR)
endif
# distinstall also installs the example-sources and omits the location of the source-
# files from the fpunits.cfg files.
distinstall: fpmake$(SRCEXEEXT)
ifdef UNIXHier
$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) -ie -fsp 0
else
$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR) -ie -fsp 0
endif
#
# Custom installer
#
PAS2JSVERSION:=$(shell pas2js -iV)
RTLFILES=$(wildcard src/rtl/*.pas)
RTLFILES+=rtl/rtl.js rtl/pas2js_rtl.lpk
PACKAGEFILES=$(wildcard packages/*/*.pas)
PACKAGEFILES+=$(wildcard packages/*/*.pp)
PACKAGEFILES+=$(wildcard packages/*/*.lpk)
DEMOFILES=$(wildcard demo/rtl/*.html)
DEMOFILES+=$(wildcard demo/rtl/*.pas)
DEMOFILES+=$(wildcard demo/rtl/*.lpi)
DEMOFILES+=$(wildcard demo/rtl/*.lpr)
DEMOFILES+=demo/rtl/countries.json
DEMOFILES+=$(wildcard demo/jquery/*.lpr)
DEMOFILES+=$(wildcard demo/jquery/*.lpi)
DEMOFILES+=$(wildcard demo/jquery/*.pas)
DEMOFILES+=$(wildcard demo/jquery/*.html)
DEMOFILES+=$(wildcard demo/fpreport/*.html)
DEMOFILES+=$(wildcard demo/fpreport/*.lpi)
DEMOFILES+=$(wildcard demo/fpreport/*.lpr)
DEMOFILES+=$(wildcard demo/fpreport/*.pp)
DEMOFILES+=$(wildcard demo/fpreport/*.md)
DEMOFILES+=$(wildcard demo/hotreload/*.html)
DEMOFILES+=$(wildcard demo/hotreload/*.lpr)
DEMOFILES+=$(wildcard demo/hotreload/*.lpi)
DEMOFILES+=$(wildcard demo/hotreload/*.pas)
DEMOFILES+=$(wildcard demo/fpcunit/*.html)
DEMOFILES+=$(wildcard demo/fpcunit/*.lpr)
DEMOFILES+=$(wildcard demo/fpcunit/*.lpi)
DEMOFILES+=$(wildcard demo/fpcunit/*.pas)
DEMOFILES+=$(wildcard demo/fcldb/*.html)
DEMOFILES+=$(wildcard demo/fcldb/*.lpr)
DEMOFILES+=$(wildcard demo/fcldb/*.lpi)
DEMOFILES+=$(wildcard demo/fcldb/*.pas)
DEMOFILES+=$(wildcard demo/fcldb/*.json)
DEMOFILES+=demo/rtl/README.md
DOCFILES=README.md
DOCFILES+=docs/translation.html
ZIPFILE=pas2js-demo-$(PAS2JSVERSION).zip
COMPILERS=$(wildcard bin/$(PAS2JSVERSION)/pas2js*)
COMPILERS+=$(wildcard bin/$(PAS2JSVERSION)/libpas2js*)
URL=http://www.freepascal.org/~michael/pas2js/
CFGFILE=bin/$(PAS2JSVERSION)/pas2js.cfg
info:
@echo "Detected pas2js version: $(PAS2JSVERSION)"
@echo "Supported targets:"
@echo "all compile for current platform"
@echo "info this info"
@echo "zip zip file with demo executables"
@echo "upload upload zip to $(URL)$(ZIPFILE)"
@echo "config create config file in bin dir"
@echo "URL for $(PAS2JSVERSION): $(URL)$(ZIPFILE)"
config:
./createconfig.sh $(CFGFILE) ../..
zip: config
@echo Version: $(PAS2JSVERSION)
rm -f $(ZIPFILE)
zip $(ZIPFILE) $(COMPILERS) $(RTLFILES) $(PACKAGEFILES) $(DOCFILES) $(DEMOFILES) $(CFGFILE)
upload: zip
scp $(ZIPFILE) idefix.freepascal.org:public_html/pas2js
@echo URL: $(URL)$(ZIPFILE)