-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
252 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# package name | ||
PACKAGE = svg | ||
|
||
MAKESOURCE = $(MAKE) -C source | ||
|
||
.PHONY: all $(PACKAGE) pdf mostlyclean clean dist distclean release releaseclean install uninstall | ||
|
||
all: | ||
$(MAKESOURCE) all | ||
pdf: | ||
$(MAKESOURCE) pdf | ||
mostlyclean: | ||
$(MAKESOURCE) mostlyclean | ||
clean: | ||
$(MAKESOURCE) clean | ||
dist: | ||
$(MAKESOURCE) dist | ||
distclean: | ||
$(MAKESOURCE) distclean | ||
release: | ||
$(MAKESOURCE) release | ||
releaseclean: | ||
$(MAKESOURCE) releaseclean | ||
install: | ||
$(MAKESOURCE) install | ||
uninstall: | ||
$(MAKESOURCE) uninstall | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# package name | ||
PACKAGE = svg | ||
# formatting tools | ||
LATEX = pdflatex | ||
TEX = tex | ||
|
||
include osutils.mak | ||
include texutils.mak | ||
|
||
# source files and package version | ||
SRC__FILE := $(PACKAGE).dtx | ||
SRC_FILES := $(sort $(SRC__FILE) $(wildcard *.dtx)) | ||
EXM_FILES := $(wildcard examples/*.tex) $(wildcard examples/*.svg) $(wildcard examples/*.C) | ||
AUX_FILES := $(wildcard Makefile*) $(wildcard *.mak) $(wildcard *.mk) $(wildcard *.bat) | ||
SRC_DIRS := $(sort $(dir $(SRC_FILES) $(EXM_FILES) $(AUX_FILES))) | ||
SRC_DIRS := $(filter-out ./, $(SRC_DIRS)) | ||
|
||
# created files | ||
OUT_FILES := $(PACKAGE).sty $(PACKAGE)-extract.sty | ||
DOC__FILE := $(PACKAGE).pdf | ||
DOC_FILES := $(DOC__FILE) | ||
|
||
VERSION := $(strip $(call get_version, $(SRC__FILE))) | ||
$(info ------------------------------------------------) | ||
$(info This is version $(VERSION) of package $(PACKAGE)) | ||
$(info ------------------------------------------------) | ||
|
||
# release files and folders | ||
MD_FILES := $(wildcard ../*.md) | ||
RLS_DIR := ../release_$(VERSION)/ | ||
GIT_DIR := $(RLS_DIR)GitHub/ | ||
CTAN_DIR := $(RLS_DIR)CTAN/ | ||
# TDS folders | ||
TDS_SUFFIX := latex/$(PACKAGE)/ | ||
TDS_DOC_DIR := doc/$(TDS_SUFFIX) | ||
TDS_SRC_DIR := source/$(TDS_SUFFIX) | ||
TDS_EXM_DIR := source/$(TDS_SUFFIX)examples/ | ||
TDS_TEX_DIR := tex/$(TDS_SUFFIX) | ||
TDS_DIRS := $(TDS_DOC_DIR) $(TDS_SRC_DIR) $(TDS_EXM_DIR) $(TDS_TEX_DIR) | ||
# installation folder | ||
TEXMF_HOME := $(shell kpsewhich --var-value=TEXMFHOME)/ | ||
|
||
|
||
# temporary directories which can be deleted in any case | ||
TMP_DIRS := $(sort $(dir $(wildcard */))) | ||
TMP_DIRS := $(filter-out $(SRC_DIRS), $(TMP_DIRS)) | ||
# temporary files which are created within source directories | ||
TMP_FILES := $(wildcard *.* $(TMP_FILES)) | ||
TMP_FILES += $(foreach DIR,$(SRC_DIRS),$(wildcard $(DIR)*.*)) | ||
TMP_FILES := $(filter-out $(SRC_FILES) $(EXM_FILES) $(AUX_FILES) $(OUT_FILES) $(DOC_FILES), $(TMP_FILES)) | ||
|
||
.PHONY: all $(PACKAGE) pdf mostlyclean clean dist distclean release releaseclean install uninstall | ||
|
||
# creates package files only | ||
all: $(PACKAGE) | ||
|
||
$(PACKAGE): $(OUT_FILES) | ||
|
||
%.sty: $(SRC__FILE) | ||
$(TEX) $< | ||
|
||
# creates documentation only | ||
pdf: $(DOC__FILE) | ||
|
||
%.pdf: $(SRC__FILE) $(SRC_FILES) | ||
$(MAKE) mostlyclean | ||
$(LATEX) --shell-escape "\def\tudfinalflag{}\input{$<}" | ||
$(LATEX) "\def\tudfinalflag{}\input{$<}" | ||
$(LATEX) --shell-escape "\def\tudfinalflag{}\input{$<}" | ||
$(LATEX) "\def\tudfinalflag{}\input{$<}" | ||
$(LATEX) "\def\tudfinalflag{}\input{$<}" | ||
$(LATEX) --shell-escape "\def\tudfinalflag{}\input{$<}" | ||
|
||
# removes all temporary files created with all or doc | ||
mostlyclean: | ||
$(call rm_dirs,$(TMP_DIRS)) | ||
$(call rm_files,$(TMP_FILES)) | ||
|
||
# addtionally removes package files and documentation | ||
clean: mostlyclean | ||
$(call rm_files,$(OUT_FILES)) | ||
$(call rm_files,$(DOC_FILES)) | ||
|
||
# creates TDS folder structure with generated files | ||
dist: $(PACKAGE) pdf | ||
$(call rm_dirs,$(RLS_DIR)) | ||
$(call copy_tds,$(RLS_DIR)) | ||
|
||
# removes TDS folder structure | ||
distclean: | ||
$(call rm_tds,$(RLS_DIR)) | ||
$(call rm_tds,$(GIT_DIR)) | ||
$(call rm_dirs,$(CTAN_DIR)$(PACKAGE)/) | ||
|
||
# creates zip files for CTAN and GitHub from TDS folder structure | ||
release: $(PACKAGE) pdf | ||
$(call rm_dirs,$(GIT_DIR)) | ||
$(call copy_tds,$(GIT_DIR)) | ||
$(call rm_dirs,$(CTAN_DIR)) | ||
$(call copy_tds,$(CTAN_DIR)$(PACKAGE)/,$(TDS_SUFFIX)) | ||
$(call cp_files,$(CTAN_DIR)$(PACKAGE)/$(subst $(TDS_SUFFIX),,$(TDS_DOC_DIR))README.md,$(CTAN_DIR)$(PACKAGE)) | ||
cd $(GIT_DIR) && zip -r $(PACKAGE)_$(VERSION).zip * | ||
cd $(CTAN_DIR) && zip -r -D $(PACKAGE).zip * \ | ||
-x "$(PACKAGE)/$(subst $(TDS_SUFFIX),,$(TDS_TEX_DIR))*.*" "$(PACKAGE)/$(subst $(TDS_SUFFIX),,$(TDS_DOC_DIR))README.md" | ||
$(MAKE) distclean | ||
|
||
releaseclean: | ||
$(call rm_dirs,$(RLS_DIR)) | ||
|
||
# installs all files in TDS folder structur in TEXMF_HOME | ||
install: $(PACKAGE) pdf | ||
$(call copy_tds,$(TEXMF_HOME)) | ||
texhash | ||
|
||
# removes all installed files from TEXMF_HOME | ||
uninstall: | ||
$(call rm_dirs,$(addprefix $(TEXMF_HOME),$(TDS_DIRS))) | ||
texhash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
ifeq ($(OS),Windows_NT) | ||
RM = del /Q /F | ||
RD = rmdir /Q /S | ||
MD = mkdir | ||
CP = copy /Y | ||
#MV = move /Y | ||
define rm_dirs | ||
$(foreach DIR,$(subst /,\,$(1)), | ||
$(shell if exist $(DIR) $(RD) $(DIR)) | ||
) | ||
endef | ||
define mk_dirs | ||
$(foreach DIR,$(subst /,\,$(1)), | ||
$(shell if not exist $(DIR) $(MD) $(DIR)) | ||
) | ||
endef | ||
define rm_files | ||
$(foreach FILE,$(subst /,\,$(1)), | ||
$(shell if exist $(FILE) $(RM) $(FILE)) | ||
) | ||
endef | ||
define cp_files | ||
$(foreach FILE,$(subst /,\,$(1)), | ||
$(shell echo $(CP) $(FILE) $(subst /,\,$(2))) | ||
) | ||
endef | ||
#define mv_files | ||
# $(foreach FILE,$(subst /,\,$(1)), | ||
# $(shell echo $(MV) $(FILE) $(subst /,\,$(2))) | ||
# ) | ||
#endef | ||
else | ||
RM = rm -f | ||
RD = rm -f -r | ||
MD = mkdir -p | ||
CP = cp | ||
#MV = mv | ||
define rm_dirs | ||
$(RD) $(1) | ||
endef | ||
define mk_dirs | ||
$(MD) $(1) | ||
endef | ||
define rm_files | ||
$(RM) $(1) | ||
endef | ||
define cp_files | ||
$(CP) $(1) $(2) | ||
endef | ||
#define mv_files | ||
# $(MV) $(1) $(2) | ||
#endef | ||
endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
ifeq ($(OS),Windows_NT) | ||
define get_rawversion | ||
$(shell findstr /r /c:"^ [1-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]" $(1)) | ||
endef | ||
else | ||
define get_rawversion | ||
$(shell grep "^ [1-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]" $(1)) | ||
endef | ||
endif | ||
|
||
define get_version | ||
$(subst %,,$(subst \space,,$(word 2, $(call get_rawversion,$(1))))) | ||
endef | ||
|
||
define copy_tds | ||
$(call mk_dirs,$(addprefix $(1),$(subst $(2),,$(TDS_DIRS)))) | ||
$(call cp_files,$(DOC_FILES),$(addprefix $(1),$(subst $(2),,$(TDS_DOC_DIR)))) | ||
$(call cp_files,$(MD_FILES),$(addprefix $(1),$(subst $(2),,$(TDS_DOC_DIR)))) | ||
$(call cp_files,$(SRC_FILES),$(addprefix $(1),$(subst $(2),,$(TDS_SRC_DIR)))) | ||
$(call cp_files,$(EXM_FILES),$(addprefix $(1),$(subst $(2),,$(TDS_EXM_DIR)))) | ||
$(call cp_files,$(OUT_FILES),$(addprefix $(1),$(subst $(2),,$(TDS_TEX_DIR)))) | ||
endef | ||
|
||
define rm_tds | ||
$(call rm_dirs,$(addprefix $(1),$(subst $(TDS_SUFFIX),,$(TDS_DIRS)))) | ||
endef | ||
|