# TOOLS
# -----------------------------------------------
-TAR ?= tar
-PNDOC ?= pandoc
+TAR ?= tar
+ZIP ?= zip
+PNDC ?= pandoc
# -----------------------------------------------
# SYSTEM DETECTION
APPNAME = mhash384g
endif
+PKGPATH = $(OUTDIR)/$(APPNAME).$(ISODATE).$(OS_TYPE)
+TARFILE = $(PKGPATH).tgz
+ZIPFILE = $(PKGPATH).zip
+
ifeq ($(words $(filter %mingw32 %windows-gnu %cygwin %cygnus,$(OS_TYPE))),0)
SUFFIX = run
+ TARGET = $(TARFILE)
else
SUFFIX = exe
+ TARGET = $(ZIPFILE)
endif
EXEFILE = $(APPNAME).$(SUFFIX)
-TARFILE = $(OUTDIR)/$(APPNAME).$(ISODATE).$(OS_TYPE).tgz
ifneq ($(NODOCS),1)
-DOCFILE = README.html
+ DOCFILE = README.html
else
-DOCFILE = README.md
+ DOCFILE = README.md
endif
# -----------------------------------------------
.PHONY: all clean $(SUBDIRS) $(CLEANUP)
-all: $(TARFILE)
+all: $(TARGET)
$(TARFILE): $(SUBDIRS) $(DOCFILE)
@printf "\033[1;36m===[Make package]===\033[0m\n"
$(TAR) -czvf $@ COPYING.txt $(DOCFILE) img/mhash384/*.jpg -C $(BINDIR) $(EXEFILE) BUILD_TAG.txt
@printf "\033[1;32mCompleted.\033[0m\n"
+$(ZIPFILE): $(SUBDIRS) $(DOCFILE)
+ @printf "\033[1;36m===[Make package]===\033[0m\n"
+ @mkdir -p $(dir $@)
+ rm -f $@
+ $(ZIP) -j $@ COPYING.txt $(DOCFILE) $(BINDIR)/$(EXEFILE) $(BINDIR)/BUILD_TAG.txt && $(ZIP) $@ img/mhash384/*.jpg
+ @printf "\033[1;32mCompleted.\033[0m\n"
+
$(SUBDIRS):
@printf "\033[1;36m===[Make %s]===\033[0m\n" $@
$(MAKE) -C $@
%.html: %.md
@printf "\033[1;36m===[Make %s]===\033[0m\n" $(basename $@)
- $(PNDOC) --from markdown_github+pandoc_title_block+header_attributes+implicit_figures+yaml_metadata_block --to html5 --toc -N --standalone -H etc/css/style.inc -o $@ $<
+ $(PNDC) --from markdown_github+pandoc_title_block+header_attributes+implicit_figures+yaml_metadata_block --to html5 --toc -N --standalone -H etc/css/style.inc -o $@ $<
+ @printf "\033[1;32mCompleted.\033[0m\n"
clean: $(CLEANUP)
@printf "\033[1;31m===[Clean package]===\033[0m\n"
* **`STATIC`**: If set to `1`, link with *static* CRT libraries; otherwise link with *shared* CRT libraries (default is `0`)
* **`DEBUG`**: If set to `1`, generate a binary suitable for debugging; otherwise generate an optimized binary (default is `0`)
* **`NODOCS`**: If set to `1`, the HTML documents are **no** generated; useful where pandoc is unavailable (default is `0`)
+* **`SANITIZE`**: Instrument the binary with the specified sanitizer, e.g. `address` to enable the [*AddressSanitizer*](https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Instrumentation-Options.html#index-fsanitize_003daddress) (*no* default)
+
+The following options can be used to override the default tools used by the makefiles:
+
* **`CXX`**: The C++ compiler to be used (default is *system-specific*, e.g. `g++` or `clang++`)
* **`AR`**: The archiver to be used (default is *system-specific*, usually `ar`)
* **`STRIP`**: The strip program to be used (default is `strip`)
-* **`WNDRS`**: The Windows resource compiler to be used, used on Cygwin and MinGW only (default is `windres`)
-* **`PNDOC`**: The pandoc document converter to be used (default is `pandoc`)
+* **`PNDC`**: The document converter to be used (default is `pandoc`)
* **`TAR`**: The tarball program to be used (default is `tar`)
-* **`SANITIZE`**: Instrument the binary with the specified sanitizer, e.g. `address` to enable [*AddressSanitizer*](https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Instrumentation-Options.html#index-fsanitize_003daddress) (*no* default)
+* **`WNDRS`**: The Windows resource compiler to be used, used on Cygwin and MinGW only (default is `windres`)
+* **`ZIP`**: The zip program to be used, used on Cygwin and MinGW only (default is `zip`)
### Windows support