update build system
authorMikhail Kobuk <[email protected]>
Sat, 13 Apr 2024 04:25:01 +0000 (07:25 +0300)
committerMikhail Kobuk <[email protected]>
Sat, 13 Apr 2024 04:25:01 +0000 (07:25 +0300)
Makefile
mksite.sh

index 1d93d289bec45ab79ad339b7177eb165af118cd5..eb2afa2be19efb45bfaae7a344051208b9b35a99 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,7 @@ SRC_INTRO = index.md
 OUT_INTRO = $(patsubst %.md,%.html, $(SRC_INTRO))
 SRC = $(wildcard ./lab*)
 SRC += $(SRC_INTRO)
+SITE_NAME=LinuxLabs
 
 default: all
 
@@ -15,9 +16,9 @@ all: build
 
 build: prerequisites
        ./build.sh "$(PANDOC)" "$(PD_FLAGS)" "$(PD_FORMAT)" $(SRC)
-       mkdir -pv ./LinuxLabs
-       ./mksite.sh $(SRC)
-       tar -czvf LinuxLabs.tar.gz LinuxLabs/
+       mkdir -pv ./$(SITE_NAME)
+       ./mksite.sh  $(SRC)
+       tar -czvf $(SITE_NAME).tar.gz $(SITE_NAME)/
 
 standalone: prerequisites
        ./build.sh "$(PANDOC)" "$(PD_FLAGS) $(PD_STANDALONE)" "$(PD_FORMAT)" $(SRC)
@@ -25,9 +26,13 @@ standalone: prerequisites
 clean:
        rm -rf easy-pandoc-templates
        rm -f ./*.html
+       rm -rf $(SITE_NAME)
+       rm -rf $(SITE_NAME).tar.gz
 
 clear:
        rm -f ./*.html
+       rm -rf $(SITE_NAME)
+       rm -rf $(SITE_NAME).tar.gz
 
 prerequisites: easy-pandoc-templates $(SRC)
 
index c0bbc8f7b35c50cc4c114bf3050978e40df0ac62..6c6b6cd3d38b34f037d6874ff2f5e0d9fa667de9 100755 (executable)
--- a/mksite.sh
+++ b/mksite.sh
@@ -2,7 +2,8 @@
 
 # USE: ./build.sh <pandoc> <pandoc_flags> <pandoc_format> [sources]
 
-sources=${@}
+sitedir=$1
+sources=${@:2}
 echo "sources: ${sources}"
 
 function process_dir() {
@@ -14,10 +15,10 @@ function process_dir() {
                indir_out="${indir_src##*/}"
                ${panexec} ${panflags} ${indir_src} ${panformat} -o ../${indir_out%.*}.html
 
-               mkdir ../site/${arg_dir}
+               mkdir ../${sitedir}/${arg_dir}
 
-               cp -v ./*.png ../site/${arg_dir}
-               mv -v ../${indir_out%.*}.html ../site/${arg_dir}/index.html
+               cp -v ./*.png ../${sitedir}/${arg_dir}
+               mv -v ../${indir_out%.*}.html ../${sitedir}/${arg_dir}/index.html
 
                popd
 }
@@ -37,7 +38,7 @@ for src in ${sources}; do
                printf "\tfound md file: ${src}\n"
 
                printf "\tmv -v ${src%.*}.html ../site/${src%.*}.html\n"
-               mv -v ${src%.*}.html site/
+               mv -v ${src%.*}.html ${sitedir}/
        else
                printf "Unknown source (%s) - skipping\n" "$src"
        fi

Powered by Git