Skip to content

Commit

Permalink
Integrate exomizer.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcitor committed May 6, 2020
1 parent 1572888 commit 8583e4d
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sdcc-project.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,15 @@ CDTC_ENV_FOR_IDSK=$(CDTC_ROOT)/tool/idsk/build_config.inc
$(CDTC_ENV_FOR_IDSK):
( export LC_ALL=C ; $(MAKE) -C "$(@D)" ; )

########################################################################
# Conjure up data compression tool exomizer
########################################################################

CDTC_ENV_FOR_EXOMIZER=$(CDTC_ROOT)/tool/exomizer/build_config.inc

$(CDTC_ENV_FOR_EXOMIZER):
( export LC_ALL=C ; $(MAKE) -C "$(@D)" ; )

########################################################################
# Conjure up addhead
########################################################################
Expand Down
2 changes: 2 additions & 0 deletions tool/exomizer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
exomizer-3.0.2.zip
exomizer
133 changes: 133 additions & 0 deletions tool/exomizer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
SHELL=/bin/bash

VARIABLES_AT_MAKEFILE_START := $(.VARIABLES)

TARGETS=build_config.inc

.PHONY: all

all: $(TARGETS)

########################################################################
# Variables to adjust at each new integrated project
########################################################################

PRODUCT_NAME=exomizer
URL_RELEASE=https://bitbucket.org/magli143/exomizer/wiki/downloads/exomizer-3.0.2.zip

# If the end of the URL does not make a suitable file name, set ARCHIVE_NAME to a suitable file name.
# Example : URL ends in /download -> define ARCHIVE_NAME to something suitable
# Example : URL ends in foo.tar.gz -> do not define ARCHIVE_NAME
#ARCHIVE_NAME=$(PRODUCT_NAME)_latest.tgz

# You must set EXTRACT_DIR_NAME to match archive content.
EXTRACT_DIR_NAME=$(PRODUCT_NAME)

# If only one generated executable file, set BUILD_TARGET_FILE to path to it.
# It several generated executable files, do not set BUILD_TARGET_FILE.
BUILD_DIR=$(EXTRACT_DIR_NAME)/src
BUILD_TARGET_FILE=$(BUILD_DIR)/${PRODUCT_NAME}

URL_DOWNLOAD=$(URL_RELEASE)

ARCHIVE_NAME?=$(notdir $(URL_DOWNLOAD))

$(ARCHIVE_NAME):
set -xv ; wget -S "$(URL_RELEASE)" -O $@.tmp
mv -vf $@.tmp $@
@echo "************************************************************************"
@echo "**************** Source archive was downloaded to: $(@)"
@echo "************************************************************************"

$(EXTRACT_DIR_NAME)/.unpacked: $(ARCHIVE_NAME)
@echo "************************************************************************"
@echo "**************** Extracting source from: $^"
@echo "************************************************************************"
mkdir -p $(EXTRACT_DIR_NAME) ; cd $(EXTRACT_DIR_NAME) ; unzip ../$<
touch $@
@echo "************************************************************************"
@echo "**************** Source extracted to: $(@D)"
@echo "************************************************************************"

PATCHNAME=$(EXTRACT_DIR_NAME)_build_patch.patch

.PHONY: patch

patch: $(EXTRACT_DIR_NAME)/.patched

ifeq ($(wildcard $(PATCHNAME)),)
$(EXTRACT_DIR_NAME)/.patched: $(EXTRACT_DIR_NAME)/.unpacked
@echo "************************************************************************"
@echo "**************** No patch to apply to: $^"
@echo "************************************************************************"
touch $@
@echo "************************************************************************"
@echo "**************** Source patched in: $(@D)"
@echo "************************************************************************"
else
$(EXTRACT_DIR_NAME)/.patched: $(PATCHNAME) $(EXTRACT_DIR_NAME)/.unpacked
@echo "************************************************************************"
@echo "**************** Patching source in: $^"
@echo "************************************************************************"
#patch -p0 < $<
touch $@
@echo "************************************************************************"
@echo "**************** Source patched in: $(@D)"
@echo "************************************************************************"
endif

BUILD_TARGET_FILE?=$(EXTRACT_DIR_NAME)/.built

$(BUILD_TARGET_FILE): $(EXTRACT_DIR_NAME)/.patched
@echo "************************************************************************"
@echo "**************** Configuring and build in: $^"
@echo "************************************************************************"
$(MAKE) -C "$(BUILD_DIR)" --print-directory
touch "$@"
@echo "************************************************************************"
@echo "**************** Configured and built in: $(@D)"
@echo "************************************************************************"

build_config.inc: $(BUILD_TARGET_FILE) Makefile
(set -eu ; \
{ \
echo "# with bash do \"source\" this file." ; \
echo "export EXOMIZER_ROOT=\"$${PWD}\"" ; \
cd "$(<D)" ; \
echo "export PATH=\"\$${PATH}:$$PWD\"" ; \
} >$@ ; )

#$(PRODUCT_NAME): $(BUILD_TARGET_FILE)
# cp -avf $< $@

.PHONY: install

install: $(BUILD_TARGET_FILE)
@ if [[ -z "$PREFIX_BIN" ]] ; then echo >&2 "PREFIX_BIN not set. Aborting." ; exit 1 ; fi
@echo "************************************************************************"
@echo "**************** Installing: $^"
@echo "************************************************************************"
install -s -D -v --target-directory=$(PREFIX_BIN) $(BUILD_TARGET_FILE)
@echo "************************************************************************"
@echo "**************** Configured and built in: $(@D)"
@echo "************************************************************************"

clean:
-$(MAKE) -C "$(BUILD_DIR)" clean
-rm -f $(BUILD_TARGET_FILE)

mrproper:
-rm -f $(BUILD_TARGET_FILE)
-rm -f $(TARGETS)
-rm -rf $(EXTRACT_DIR_NAME) ._$(EXTRACT_DIR_NAME) *~
-rm -f $(PRODUCT_NAME)

distclean: mrproper
-rm -f $(ARCHIVE_NAME)

########################################################################
# Debug the makefile
########################################################################
$(foreach v, \
$(filter-out $(VARIABLES_AT_MAKEFILE_START) VARIABLES_AT_MAKEFILE_START,$(.VARIABLES)), \
$(info $(v) = $($(v))))

0 comments on commit 8583e4d

Please sign in to comment.