diff --git a/.github/workflows/euphoria.yml b/.github/workflows/euphoria.yml index 6c16f841..3044e359 100644 --- a/.github/workflows/euphoria.yml +++ b/.github/workflows/euphoria.yml @@ -3,66 +3,107 @@ name: Euphoria on: push: - branches: [ master ] + branches: + - master + tags: + - 4.2* pull_request: - branches: [ master ] + branches: + - master workflow_dispatch: jobs: build-euphoria: name: Build Euphoria - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: matrix: - plat: ['LINUX','WINDOWS'] - arch: ['x86','x86_64'] + platform: [linux-arm, linux-x86, linux-x64, windows-x86, windows-x64] defaults: run: working-directory: ./source steps: - - name: Checkout Repository - id: checkout-repository - uses: actions/checkout@v2 + - name: Checkout euphoria + id: checkout-euphoria-repo + uses: actions/checkout@v4 + + - name: Checkout creole + id: checkout-creole-repo + uses: actions/checkout@v4 + with: + repository: OpenEuphoria/creole + path: source/creole + ref: master + + - name: Checkout eudoc + id: checkout-eudoc-repo + uses: actions/checkout@v4 + with: + repository: OpenEuphoria/eudoc + path: source/eudoc + ref: master + + - name: Install Compilers (Linux ARM) + id: install-compilers-linux-arm + if: matrix.platform == 'linux-arm' + run: sudo apt-get -qy install {binutils,gcc}-arm-linux-gnu + - name: Install Compilers (Linux x86) id: install-compilers-linux-x86 - if: matrix.plat == 'LINUX' && matrix.arch == 'x86' - run: | - sudo apt-get -qy install {binutils,gcc}-i686-linux-gnu - echo "cc-prefix=i686-linux-gnu-" >> $GITHUB_ENV + if: matrix.platform == 'linux-x86' + run: sudo apt-get -qy install {binutils,gcc}-i686-linux-gnu + - name: Install Compilers (Windows x86) id: install-compilers-windows-x86 - if: matrix.plat == 'WINDOWS' && matrix.arch == 'x86' - run: | - sudo apt-get -qy install {binutils,gcc}-mingw-w64-i686 - echo "cc-prefix=i686-w64-mingw32-" >> $GITHUB_ENV + if: matrix.platform == 'windows-x86' + run: sudo apt-get -qy install {binutils,gcc}-mingw-w64-i686 + - name: Install Compilers (Windows x64) id: install-compilers-windows-x64 - if: matrix.plat == 'WINDOWS' && matrix.arch == 'x86_64' - run: | - sudo apt-get -qy install {binutils,gcc}-mingw-w64-x86-64 - echo "cc-prefix=x86_64-w64-mingw32-" >> $GITHUB_ENV + if: matrix.plat == 'windows-x64' + run: sudo apt-get -qy install {binutils,gcc}-mingw-w64-x86-64 + + - name: Install Ccache + id: install-ccache + run: sudo apt-get -qy install ccache + - name: Install Euphoria id: install-euphoria run: | wget -q https://github.com/OpenEuphoria/euphoria/releases/download/4.1.0/euphoria-4.1.0-Linux-x64-57179171dbed.tar.gz -O- | sudo tar -C /usr/local -xz euphoria-4.1.0-Linux-x64/{bin,include} cd /usr/local/bin; sudo find /usr/local/euphoria-4.1.0-Linux-x64/bin -type f -executable -exec ln -s {} \; - - name: Run Configure - id: run-configure - run: ./configure --arch='${{matrix.arch}}' --plat='${{matrix.plat}}' --cc-prefix='${{env.cc-prefix}}' + + - name: Save/Load Cache + id: save-load-cache + uses: actions/cache@v4 + with: + path: ~/.cache/ccache/ + key: ccache=${{matrix.platform}} + - name: Build Euphoria id: build-euphoria run: | - make all - make htmldoc + make -f build.mak -j$(nproc) PLATFORM=${{matrix.platform}} USE_CCACHE=1 WITH_CREOLE=1 WITH_EUDOC=1 echo "euphoria-version=$(./build/echoversion)" >> $GITHUB_ENV + - name: Get Short Hash id: get-short-hash - uses: benjlevesque/short-sha@v1.2 + uses: benjlevesque/short-sha@v2.2 + - name: Upload Artifacts id: upload-artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: euphoria-${{env.euphoria-version}}-${{matrix.plat}}-${{matrix.arch}}-${{env.SHA}} + name: euphoria-${{env.euphoria-version}}-${{matrix.platform}}-${{env.SHA}} path: | - ./source/build/ + ./source/build-${{matrix.platform}}/ + ./source/config-${{matrix.platform}}}.gnu !./source/build/**/*.o + + - name: Publish Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + body_path: ../docs/release/${{env.euphoria-version}}.txt + prerelease: true + files: euphoria-${{env.euphoria-version}}-${{matrix.platform}}-${{env.SHA}}.* diff --git a/makecfg.bat b/makecfg.bat new file mode 100644 index 00000000..64e5198a --- /dev/null +++ b/makecfg.bat @@ -0,0 +1,53 @@ +@ECHO OFF +SET BASEDIR=%~dp0 +SET EUDIR=%BASEDIR:~0,-1% +SET CONFIG=%EUDIR%\bin\eu.cfg + +:defarch +IF "%PROCESSOR_ARCHITECTURE%" == "x86" SET DEFARCH=X86 +IF "%PROCESSOR_ARCHITECTURE%" == "AMD64" SET DEFARCH=X86_64 + +:setarch32 +IF "%1" == "X86" ( + SET ARCH=%1 + GOTO makecfg +) + +:setarch64 +IF "%1" == "X86_64" ( + SET ARCH=%1 + GOTO makecfg +) + +:default +IF "%1" == "" ( + SET ARCH=%DEFARCH% + GOTO makecfg +) + +:badarch +ECHO Invalid arch "%1" +EXIT /B 1 + +:makedir +IF NOT EXIST %EUDIR%\bin ( + MKDIR %EUDIR%\bin +) + +:makecfg +ECHO Writing contents to: %CONFIG% +ECHO [all] > %CONFIG% +ECHO -eudir %EUDIR% >> %CONFIG% +ECHO -i %EUDIR%\include >> %CONFIG% +ECHO [translate] >> %CONFIG% +ECHO -arch %ARCH% >> %CONFIG% +ECHO -gcc >> %CONFIG% +ECHO -com %EUDIR% >> %CONFIG% +ECHO -con >> %CONFIG% +ECHO -lib-pic %EUDIR%\bin\euso.a >> %CONFIG% +ECHO -lib %EUDIR%\bin\eu.a >> %CONFIG% +ECHO [bind] >> %CONFIG% +ECHO -eub %EUDIR%\bin\eub.exe >> %CONFIG% +TYPE %CONFIG% +:done +PAUSE diff --git a/makecfg.sh b/makecfg.sh new file mode 100755 index 00000000..f576e411 --- /dev/null +++ b/makecfg.sh @@ -0,0 +1,40 @@ +#!/bin/bash +EUDIR=$(realpath $(dirname $0)) +CONFIG=$EUDIR/bin/eu.cfg + +#defarch +if [ "$(uname -m)" == "i686" ]; then DEFARCH="X86"; fi +if [ "$(uname -m)" == "x86_64" ]; then DEFARCH="X86_64"; fi + +#setarch32 +if [ "$1" == "X86" ]; then + ARCH=$1 +#setarch64 +elif [ "$1" == "X86_64" ]; then + ARCH=$1 +#default +elif [ "$1" == "" ]; then + ARCH=$DEFARCH +#badarch +else + echo Invalid arch "$1" + exit 1 +fi + +#makecfg +mkdir -p $EUDIR/bin +echo Writing contents to: $CONFIG +echo [all] > $CONFIG +echo -eudir $EUDIR >> $CONFIG +echo -i $EUDIR/include >> $CONFIG +echo [translate] >> $CONFIG +echo -arch $ARCH >> $CONFIG +echo -gcc >> $CONFIG +echo -com $EUDIR >> $CONFIG +echo -con >> $CONFIG +echo -lib-pic $EUDIR/bin/euso.a >> $CONFIG +echo -lib $EUDIR/bin/eu.a >> $CONFIG +echo [bind] >> $CONFIG +echo -eub $EUDIR/bin/eub >> $CONFIG +cat $CONFIG +read -p "Press any key to continue . . ." diff --git a/source/build.mak b/source/build.mak index 471414dd..55655301 100644 --- a/source/build.mak +++ b/source/build.mak @@ -1,13 +1,18 @@ ## ## Usage: -## make -f build.mak -j$(nproc) PLATFORM=platform [USE_CCACHE=1] +## make -f build.mak -j$(nproc) PLATFORM=platform-name [WITH_EUDOC=1] [WITH_CREOLE=1] +## [WITH_EUBIN=0] [USE_CCACHE=0] [VERBOSE=0] ## ## Options: +## -j$(nproc) Specify same number of build jobs as available CPUs. ## PLATFORM Specify one of the platform names lited below. ## USE_CCACHE Enable ccache to speed up rebuilds. Must have ccache installed. -## -j$(nproc) Command to specify same number of build jobs as available CPUs. +## WITH_EUBIN Build native eubins first to speed up subsequent steps. +## WITH_EUDOC Build latest EuDoc with the package and use it for htmldoc. +## WITH_CREOLE Build latest Creole with the package and use it for htmldoc. +## VERBOSE Show makefile commands being run. ## -## Platforms: +## Dependencies: ## - linux-x64 (none) ## - linux-arm (apt install {binutils,gcc}-arm-linux-gnu) ## - linux-x86 (apt install {binutils,gcc}-i686-linux-gnu) @@ -23,11 +28,27 @@ ## 1. Runs ./configure with the options for (cross-)compiling to the target platform. ## 2. Renames config.gnu file created by ./configure to include the platform name. ## 3. Runs make, specifying the CONFIG_FILE option to the file created in steps 1-2. +## 4. Gets creole and eudoc from GitHub, builds the binaries and add them to the package. ## 4. Collects the artifacts from the build directory into a temporary directory in /tmp. -## 5. Creates a tarball or zip file in the source directory with the files from step 4. +## 5. Creates a tarball or zip file in the source directory with the files from step 5. +## +## Note: I strongly recommend using ccache and -j$(nproc) to speed up your build times! ## MAKEFLAGS += --no-print-directory +VARIABLES := $(.VARIABLES) + +ifneq ($(shell which ccache),) + HAVE_CCACHE := 1 +else + HAVE_CCACHE := 0 +endif + +WITH_EUDOC ?= 1 +WITH_CREOLE ?= 1 +WITH_EUBIN ?= 0 +USE_CCACHE ?= $(HAVE_CCACHE) +VERBOSE ?= 0 MAKEFILE_NAME := $(abspath $(lastword $(MAKEFILE_LIST))) TRUNKDIR := $(abspath $(dir $(MAKEFILE_NAME))..) @@ -78,8 +99,10 @@ else endif BUILDDIR = $(TRUNKDIR)/source/build-$(PLATFORM) +EUBINDIR = $(TRUNKDIR)/source/build-eubin +EUCFG_FILE = $(BUILDDIR)/eu.cfg CONFIG_FILE = config-$(PLATFORM).gnu -CONFIG_PARAMS = --arch=$(ARCH) --plat=$(PLAT) --build=$(BUILDDIR) --release=$(RELEASE) --use-source-translator +CONFIG_PARAMS = --arch=$(ARCH) --plat=$(PLAT) --build=$(BUILDDIR) --release=$(RELEASE) ifeq ($(USE_CCACHE),1) CONFIG_PARAMS += --cc-prefix='ccache $(CC_PREFIX)' @@ -89,59 +112,290 @@ else HOSTCC = gcc endif +COMPILED_FILES = \ + $(BUILDDIR)/eub$(EXE_EXT) \ + $(BUILDDIR)/eui$(EXE_EXT) \ + $(BUILDDIR)/euc$(EXE_EXT) + +LIBRARY_FILES = \ + $(BUILDDIR)/eu$(LIB_EXT) \ + $(BUILDDIR)/eudbg$(LIB_EXT) \ + $(BUILDDIR)/euso$(LIB_EXT) \ + $(BUILDDIR)/eusodbg$(LIB_EXT) + +TRANSLATED_FILES = \ + $(BUILDDIR)/eubind$(EXE_EXT) \ + $(BUILDDIR)/eucoverage$(EXE_EXT) \ + $(BUILDDIR)/eudis$(EXE_EXT) \ + $(BUILDDIR)/eudist$(EXE_EXT) \ + $(BUILDDIR)/eushroud$(EXE_EXT) \ + $(BUILDDIR)/eutest$(EXE_EXT) + +ifeq ($(PLATFORM),$(filter windows-%,$(PLATFORM))) + TRANSLATED_FILES += $(BUILDDIR)/eubw$(EXE_EXT) + TRANSLATED_FILES += $(BUILDDIR)/euiw$(EXE_EXT) +endif + +BUILD_FILES = $(LIBRARY_FILES) $(COMPILED_FILES) $(TRANSLATED_FILES) +BUILD_TARGETS = $(patsubst $(BUILDDIR)/%,$(PACKAGE_PATH)/bin/%,$(BUILD_FILES)) + +ifeq ($(PLATFORM),$(filter windows-%,$(PLATFORM))) + RESOURCE_FILES = $(BUILDDIR)/eub.res $(BUILDDIR)/eubw.res $(BUILDDIR)/euc.res \ + $(BUILDDIR)/eui.res $(BUILDDIR)/euiw.res + RESOURCE_TARGETS = $(patsubst $(BUILDDIR)/%,$(PACKAGE_PATH)/bin/%,$(RESOURCE_FILES)) +endif + +INCLUDE_FILES = $(wildcard $(TRUNKDIR)/include/*.e) $(wildcard $(TRUNKDIR)/include/*/*.e) \ + $(wildcard $(TRUNKDIR)/include/*/*/*.e*) $(wildcard $(TRUNKDIR)/include/*.h) +INCLUDE_TARGETS = $(patsubst $(TRUNKDIR)/%,$(PACKAGE_PATH)/%,$(INCLUDE_FILES)) + +HTMLDOC_FILES = $(addprefix $(BUILDDIR)/html/,$(shell eui docs.ex ../docs/manual.af)) \ + $(BUILDDIR)/html/images/next.png \ + $(BUILDDIR)/html/images/prev.png \ + $(BUILDDIR)/html/js/prototype.js \ + $(BUILDDIR)/html/js/scriptaculous.js \ + $(BUILDDIR)/html/js/search.js \ + $(BUILDDIR)/html/search.dat \ + $(BUILDDIR)/html/style.css +HTMLDOC_TARGETS = $(patsubst $(BUILDDIR)/html/%,$(PACKAGE_PATH)/docs/html/%,$(HTMLDOC_FILES)) + +OTHER_FILES = \ + $(wildcard $(TRUNKDIR)/demo/*/*.*) \ + $(wildcard $(TRUNKDIR)/demo/*.*) \ + $(wildcard $(TRUNKDIR)/tests/*/*/*) \ + $(wildcard $(TRUNKDIR)/tests/*/*) \ + $(wildcard $(TRUNKDIR)/tests/*) \ + $(TRUNKDIR)/bin/bench.ex \ + $(TRUNKDIR)/bin/bugreport.ex \ + $(TRUNKDIR)/bin/buildcpdb.ex \ + $(TRUNKDIR)/bin/ecp.dat \ + $(TRUNKDIR)/bin/edx.bat \ + $(TRUNKDIR)/bin/edx.ex \ + $(TRUNKDIR)/bin/eucoverage.ex \ + $(TRUNKDIR)/bin/euloc.ex \ + $(TRUNKDIR)/bin/make31.exw \ + $(TRUNKDIR)/License.txt +ifeq ($(PLATFORM),$(filter windows-%,$(PLATFORM))) + OTHER_FILES += $(TRUNKDIR)/makecfg.bat +else + OTHER_FILES += $(TRUNKDIR)/makecfg.sh +endif +OTHER_TARGETS = $(patsubst $(TRUNKDIR)/%,$(PACKAGE_PATH)/%,$(OTHER_FILES)) + PACKAGE_NAME = euphoria-$(VERSION)-$(PLATFORM) PACKAGE_FILE = $(PACKAGE_NAME)-$(GITHASH)$(ZIP_EXT) PACKAGE_PATH = /tmp/$(PACKAGE_NAME) +PACKAGE_TARGETS = $(BUILD_TARGETS) $(INCLUDE_TARGETS) $(DEMO_TARGETS) $(HTMLDOC_TARGETS) $(OTHER_TARGETS) -BUILD_FILES := eub$(EXE_EXT) euc$(EXE_EXT) eui$(EXE_EXT) eubind$(EXE_EXT) eucoverage$(EXE_EXT) eudis$(EXE_EXT) \ - eudist$(EXE_EXT) eushroud$(EXE_EXT) eutest$(EXE_EXT) eu$(LIB_EXT) eudbg$(LIB_EXT) euso$(LIB_EXT) eusodbg$(LIB_EXT) -BUILD_FILES := $(addprefix $(PACKAGE_PATH)/bin/,$(BUILD_FILES)) +ifeq ($(PLATFORM),$(filter windows-%,$(PLATFORM))) + PACKAGE_TARGETS += $(RESOURCE_TARGETS) +endif -INCLUDE_FILES := $(wildcard $(TRUNKDIR)/include/*.e) $(wildcard $(TRUNKDIR)/include/*/*.e) \ - $(wildcard $(TRUNKDIR)/include/*/*/*.e*) $(wildcard $(TRUNKDIR)/include/*.h) -INCLUDE_FILES := $(patsubst $(TRUNKDIR)/%,$(PACKAGE_PATH)/%,$(INCLUDE_FILES)) +ifeq ($(WITH_EUBIN),1) + CONFIG_PARAMS += --eubin=$(EUBINDIR) --use-binary-translator + EUC = eui -eudir $(TRUNKDIR) -i $(TRUNKDIR)/include $(TRUNKDIR)/source/euc.ex + EUBIN_PARAMS = --use-source-translator --build=$(EUBINDIR) + ifdef USE_CCACHE + EUBIN_PARAMS += --ar='ccache ar' --cc='ccache gcc' + endif + EUBIN_CONFIG = config-eubin.gnu + EUBIN_EUCFG = $(EUBINDIR)/eu.cfg + EUBIN_LIB = $(EUBINDIR)/eu.a + EUBIN_EUC = $(EUBINDIR)/euc + EUBIN_EUI = $(EUBINDIR)/eui +else + CONFIG_PARAMS += --use-source-translator + EUBIN_EUC = euc + EUBIN_EUI = eui + EUC = $(EUBIN_EUC) +endif -HTMLDOC_FILES := $(shell eui docs.ex ../docs/manual.af) images/next.png images/prev.png \ - js/prototype.js js/scriptaculous.js js/search.js search.dat style.css -HTMLDOC_FILES := $(addprefix $(PACKAGE_PATH)/docs/html/,$(HTMLDOC_FILES)) +TRANSLATE = $(EUBIN_EUC) +EUCFLAGS = -c $(BUILDDIR)/eu.cfg -makefile -silent -OTHER_FILES = \ - $(PACKAGE_PATH)/bin/bench.ex \ - $(PACKAGE_PATH)/bin/bugreport.ex \ - $(PACKAGE_PATH)/bin/buildcpdb.ex \ - $(PACKAGE_PATH)/bin/ecp.dat \ - $(PACKAGE_PATH)/bin/edx.bat \ - $(PACKAGE_PATH)/bin/edx.ex \ - $(PACKAGE_PATH)/bin/eucoverage.ex \ - $(PACKAGE_PATH)/bin/euloc.ex \ - $(PACKAGE_PATH)/bin/make31.exw \ - $(PACKAGE_PATH)/License.txt +ifeq ($(WITH_EUDOC),1) + HTMLDOC_FLAGS += EUDOC="$(EUBIN_EUI) $(TRUNKDIR)/source/eudoc/eudoc.ex" + PACKAGE_TARGETS += $(PACKAGE_PATH)/bin/eudoc$(EXE_EXT) +endif -all : $(PACKAGE_FILE) +ifeq ($(WITH_CREOLE),1) + HTMLDOC_FLAGS += CREOLE="$(EUBIN_EUI) $(TRUNKDIR)/source/creole/creole.ex" + PACKAGE_TARGETS += $(PACKAGE_PATH)/bin/creole$(EXE_EXT) +endif -clean : - @rm -rf $(PACKAGE_PATH) $(BUILDDIR) - @rm -f $(CONFIG_FILE) $(PACKAGE_FILE) +ifneq ($(VERBOSE),1) + ECHO := @ +endif -$(PACKAGE_FILE) : $(BUILD_FILES) $(INCLUDE_FILES) $(HTMLDOC_FILES) $(OTHER_FILES) +ifeq ($(VERBOSE),1) +$(foreach v,$(filter-out .% $(VARIABLES) VARIABLES,$(sort $(.VARIABLES))),$(info $(v)=$($(v)))) +endif + +all : $(PACKAGE_FILE) + +$(PACKAGE_FILE) : $(PACKAGE_TARGETS) ifeq ($(ZIP_EXT),.tar.gz) - @tar -C /tmp -I 'gzip -9' -vcf $(abspath $@) $(sort $(patsubst /tmp/%,%,$^)) + $(ECHO)tar -C /tmp -I 'gzip -9' -vcf $(abspath $@) $(sort $(patsubst /tmp/%,%,$^)) else ifeq ($(ZIP_EXT),.zip) - @cd /tmp && zip -r9 $(abspath $@) $(sort $(patsubst /tmp/%,%,$^)) + $(ECHO)cd /tmp && zip -r9 $(abspath $@) $(sort $(patsubst /tmp/%,%,$^)) +endif + +$(BUILD_TARGETS) : $(PACKAGE_PATH)/bin/% : $(BUILDDIR)/% + @mkdir -p $(dir $@) + $(ECHO)cp -p $< $@ + $(ECHO)$(CC_PREFIX)strip -g $@ + +library: static-library +shared-library: $(BUILDDIR)/euso$(LIB_EXT) +static-library: $(BUILDDIR)/eu$(LIB_EXT) +debug-library: debug-static-library +debug-shared-library: $(BUILDDIR)/eusodbg$(LIB_EXT) +debug-static-library: $(BUILDDIR)/eudbg$(LIB_EXT) + +$(LIBRARY_FILES) : | $(CONFIG_FILE) $(EUCFG_FILE) $(BUILDDIR)/mkver$(EXE_EXT) + $(ECHO)$(MAKE) CONFIG_FILE=$(CONFIG_FILE) $@ + +backend : $(BUILDDIR)/eub$(EXE_EXT) +interpreter : $(BUILDDIR)/eui$(EXE_EXT) +translator : $(BUILDDIR)/euc$(EXE_EXT) + +$(BUILDDIR)/mkver$(EXE_EXT) : | $(CONFIG_FILE) $(EUCFG_FILE) + $(ECHO)$(MAKE) CONFIG_FILE=$(CONFIG_FILE) HOSTCC=$(HOSTCC) $@ + +$(COMPILED_FILES) : | $(LIBRARY_FILES) $(CONFIG_FILE) $(EUCFG_FILE) $(BUILDDIR)/mkver$(EXE_EXT) + $(ECHO)$(MAKE) CONFIG_FILE=$(CONFIG_FILE) TRANSLATE=$(TRANSLATE) $@ + +tools : eubind eucoverage eudis eudist eushroud eutest +eubind : $(BUILDDIR)/eubind$(EXE_EXT) +eucoverage : $(BUILDDIR)/eucoverage$(EXE_EXT) +eudis : $(BUILDDIR)/eudis$(EXE_EXT) +eudist : $(BUILDDIR)/eudist$(EXE_EXT) +eushroud : $(BUILDDIR)/eushroud$(EXE_EXT) +eutest : $(BUILDDIR)/eutest$(EXE_EXT) + +$(TRANSLATED_FILES) : | $(LIBRARY_FILES) $(CONFIG_FILE) $(EUCFG_FILE) + $(ECHO)$(MAKE) CONFIG_FILE=$(CONFIG_FILE) TRANSLATE=$(TRANSLATE) $@ + +htmldoc : $(HTMLDOC_FILES) + +$(filter-out $(BUILDDIR)/html/index.html,$(HTMLDOC_FILES)) : $(BUILDDIR)/html/index.html + +$(BUILDDIR)/html/index.html : | $(CONFIG_FILE) $(EUCFG_FILE) + @mkdir -p $(BUILDDIR)/html + $(ECHO)$(MAKE) CONFIG_FILE=$(CONFIG_FILE) $(HTMLDOC_FLAGS) htmldoc + +$(HTMLDOC_TARGETS) : $(PACKAGE_PATH)/docs/html/% : $(BUILDDIR)/html/% + @mkdir -p $(dir $@) + $(ECHO)cp -p $< $@ + +ifeq ($(PLATFORM),$(filter windows-%,$(PLATFORM))) +$(RESOURCE_TARGETS) : $(PACKAGE_PATH)/bin/% : $(BUILDDIR)/% | $(patsubst %.res,%.exe,$@) + @mkdir -p $(dir $@) + $(ECHO)cp -p $< $@ endif -$(BUILD_FILES) : $(PACKAGE_PATH)/bin/% : $(BUILDDIR)/% ; @mkdir -p $(dir $@) && cp -p $< $@ && $(CC_PREFIX)strip -g $@ +$(INCLUDE_TARGETS) : $(PACKAGE_PATH)/include/% : $(TRUNKDIR)/include/% + @mkdir -p $(dir $@) + $(ECHO)cp -p $< $@ + +$(OTHER_TARGETS) : $(PACKAGE_PATH)/% : $(TRUNKDIR)/% + @mkdir -p $(dir $@) + $(ECHO)cp -p $< $@ + +$(CONFIG_FILE) : + @mkdir -p $(BUILDDIR) + $(ECHO)./configure $(CONFIG_PARAMS) + $(ECHO)mv config.gnu $(CONFIG_FILE) + +$(EUCFG_FILE) : | $(CONFIG_FILE) + +.NOTPARALLEL: $(CONFIG_FILE) $(EUCFG_FILE) + +clean : + $(ECHO)rm -rf $(BUILDDIR) $(CONFIG_FILE) $(PACKAGE_PATH) $(PACKAGE_FILE) + +dist-clean : clean +ifeq ($(WITH_EUBIN),1) + $(ECHO)rm -rf $(EUBINDIR) $(EUBIN_CONFIG) +endif + +ifeq ($(USE_CCACHE),1) +clear-cache: + $(ECHO)rm -rf $(HOME)/.cache/ccache/* +endif + +.PHONY : all clean dist-clean backend debug-library debug-shared-library debug-static-library eubind eucoverage eudis \ + eudist eushroud eutest htmldoc interpreter library shared-library static-library tools translator $(PLATFORMS) + +ifeq ($(WITH_EUBIN),1) + +$(BUILDDIR)/html/index.html : | $(EUBIN_EUI) + +$(COMPILED_FILES) $(TRANSLATED_FILES) : | $(EUBIN_EUC) -$(INCLUDE_FILES) : $(PACKAGE_PATH)/include/% : $(TRUNKDIR)/include/% ; @mkdir -p $(dir $@) && cp -p $< $@ +# $(EUBIN_LIB) +eubin: $(EUBIN_EUC) $(EUBIN_EUI) -$(HTMLDOC_FILES) : $(PACKAGE_PATH)/docs/html/% : $(BUILDDIR)/html/% ; @mkdir -p $(dir $@) && cp -p $< $@ +#$(EUBIN_LIB) : | $(EUBIN_CONFIG) $(EUBIN_EUCFG) +# $(ECHO)$(MAKE) CONFIG_FILE=$(EUBIN_CONFIG) HOSTCC=$(HOSTCC) $@ -$(OTHER_FILES) : $(PACKAGE_PATH)/% : $(TRUNKDIR)/% ; @mkdir -p $(dir $@) && cp -p $< $@ +# $(EUBIN_LIB) +$(EUBIN_EUC) $(EUBIN_EUI): | $(EUBIN_CONFIG) $(EUBIN_EUCFG) + $(ECHO)$(MAKE) CONFIG_FILE=$(EUBIN_CONFIG) HOSTCC=$(HOSTCC) $@ -$(BUILDDIR)/html/% : $(CONFIG_FILE) ; $(MAKE) CONFIG_FILE=$< htmldoc +$(EUBIN_CONFIG) : ; @mkdir -p $(EUBINDIR) + $(ECHO)./configure $(EUBIN_PARAMS) + $(ECHO)mv config.gnu $(EUBIN_CONFIG) -$(BUILDDIR)/% : $(CONFIG_FILE) ; $(MAKE) CONFIG_FILE=$< HOSTCC=$(HOSTCC) $@ +$(EUBIN_EUCFG) : | $(EUBIN_CONFIG) -$(CONFIG_FILE) : ; ./configure $(CONFIG_PARAMS) && mv config.gnu $(CONFIG_FILE) +$(TRANSLATED_FILES) : | $(EUBIN_EUC) + +.PHONY: eubin + +.NOTPARALLEL: $(EUBIN_CONFIG) $(EUBIN_EUCFG) + +endif + +ifeq ($(WITH_EUDOC),1) + +eudoc: $(PACKAGE_PATH)/bin/eudoc$(EXE_EXT) + +$(PACKAGE_PATH)/bin/eudoc$(EXE_EXT) : $(BUILDDIR)/eudoc$(EXE_EXT) + @mkdir -p $(dir $@) + $(ECHO)cp -p $< $@ + +$(BUILDDIR)/eudoc$(EXE_EXT) : $(BUILDDIR)/eudoc-build/eudoc.mak + $(ECHO)$(MAKE) -C $(dir $<) -f $(notdir $<) + +$(BUILDDIR)/eudoc-build/eudoc.mak : $(TRUNKDIR)/source/eudoc/eudoc.ex | $(CONFIG_FILE) $(EUCFG_FILE) $(BUILDDIR)/eu$(LIB_EXT) + $(ECHO)$(EUC) $(EUCFLAGS) -build-dir $(dir $@) -o $(BUILDDIR)/eudoc$(EXE_EXT) $< + +$(TRUNKDIR)/source/eudoc/eudoc.ex : + $(ECHO)git clone --depth=1 https://github.com/OpenEuphoria/eudoc $(TRUNKDIR)/source/eudoc + +.PHONY: eudoc + +endif + +ifeq ($(WITH_CREOLE),1) + +creole: $(PACKAGE_PATH)/bin/creole$(EXE_EXT) + +$(PACKAGE_PATH)/bin/creole$(EXE_EXT) : $(BUILDDIR)/creole$(EXE_EXT) + @mkdir -p $(dir $@) + $(ECHO)cp -p $< $@ + +$(BUILDDIR)/creole$(EXE_EXT) : $(BUILDDIR)/creole-build/creole.mak + $(ECHO)$(MAKE) -C $(dir $<) -f $(notdir $<) + +$(BUILDDIR)/creole-build/creole.mak : $(TRUNKDIR)/source/creole/creole.ex | $(CONFIG_FILE) $(EUCFG_FILE) $(BUILDDIR)/eu$(LIB_EXT) + $(ECHO)$(EUC) $(EUCFLAGS) -build-dir $(dir $@) -o $(BUILDDIR)/creole$(EXE_EXT) $< + +$(TRUNKDIR)/source/creole/creole.ex : + $(ECHO)git clone --depth=1 https://github.com/OpenEuphoria/creole $(TRUNKDIR)/source/creole + +.PHONY: creole + +endif -.PHONY : all clean $(PLATFORMS)