Browse Source

Add a Makefile to compile all the lib into a single module

goSJW
Tissevert 4 years ago
parent
commit
ddf972cf48
  1. 15
      Makefile
  2. 16
      unit.js.tpl

15
Makefile

@ -0,0 +1,15 @@
BUILD_DIR=dist
TARGET=$(BUILD_DIR)/unit.js
SRC=$(wildcard *.js)
TEMPLATE=unit.js.tpl
all: $(TARGET)
$(BUILD_DIR):
mkdir -p $@
$(TARGET): $(SRC) $(BUILD_DIR)
./$(TEMPLATE) $(SRC) > $@
mrproper:
rm -rf $(BUILD_DIR)

16
unit.js.tpl

@ -0,0 +1,16 @@
#!/bin/bash
indent()
{
local tabs="$(printf '\t%.0s' `seq 1 $1`)"
sed "s|^|${tabs}|"
}
cat <<EOF
var unitJS = (function() {
return {
$(echo "${@}" | sed -e 's| |,\n|g' -e 's|\([^.\n]\+\)\.js|\u\1: \u\1|g' | indent 2)
};
$(cat "${@}" | indent 1)
})();
EOF
Loading…
Cancel
Save