antos-frontend/Makefile

161 lines
5.9 KiB
Makefile
Raw Normal View History

2017-08-11 01:58:46 +02:00
2019-12-19 22:39:48 +01:00
BUILDDIR?=build/htdocs/os
2017-08-14 00:20:19 +02:00
BLUE=\033[1;34m
2017-08-11 01:58:46 +02:00
NC=\033[0m
2018-03-15 22:36:38 +01:00
GSED=sed
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
GSED=gsed
endif
2020-02-27 18:06:05 +01:00
coffees= src/core/core.coffee \
src/core/api.coffee \
src/core/settings.coffee \
src/core/handles/RemoteHandle.coffee \
src/core/Announcerment.coffee \
src/core/vfs.coffee \
src/core/vfs/GoogleDriveHandle.coffee \
src/core/db.coffee \
src/core/gui.coffee \
src/core/BaseModel.coffee \
src/core/BaseApplication.coffee \
src/core/BaseService.coffee \
src/core/BaseEvent.coffee \
src/core/BaseDialog.coffee \
src/core/tags/tag.coffee \
src/core/tags/WindowTag.coffee \
src/core/tags/TileLayoutTags.coffee \
src/core/tags/ResizerTag.coffee \
src/core/tags/LabelTag.coffee \
2020-02-28 18:35:20 +01:00
src/core/tags/ButtonTag.coffee \
src/core/tags/ListViewTag.coffee \
2020-03-02 17:59:38 +01:00
src/core/tags/SwitchTag.coffee \
src/core/tags/NSpinnerTag.coffee \
2020-03-11 18:36:38 +01:00
src/core/tags/MenuTag.coffee \
2020-04-02 18:33:07 +02:00
src/core/tags/GridView.coffee \
2017-08-11 01:58:46 +02:00
src/antos.coffee
2017-08-17 00:42:05 +02:00
2017-08-11 01:58:46 +02:00
2020-02-21 17:56:45 +01:00
packages = CoreServices ActivityMonitor Setting ShowCase # Files MarkOn MarketPlace Preview NotePad wTerm
2017-08-14 00:20:19 +02:00
2018-03-19 10:59:45 +01:00
main: initd build_coffees build_tags build_themes schemes libs build_packages languages
2017-08-11 01:58:46 +02:00
- cp src/index.html $(BUILDDIR)/
2018-03-19 10:59:45 +01:00
initd:
- mkdir -p $(BUILDDIR)
2018-03-21 00:12:55 +01:00
lite: build_coffees build_tags build_themes schemes build_packages
2017-08-11 01:58:46 +02:00
#%.js: %.coffee
# coffee --compile $<
build_coffees:
2017-08-26 16:50:13 +02:00
@echo "$(BLUE)Building coffee files$(NC)"
2017-08-11 01:58:46 +02:00
- mkdir $(BUILDDIR)/scripts
- rm $(BUILDDIR)/scripts/antos.js
2018-01-22 19:59:08 +01:00
- rm $(BUILDDIR)/scripts/antos.coffee
2017-08-11 01:58:46 +02:00
for f in $(coffees); do (cat "$${f}"; echo) >> $(BUILDDIR)/scripts/antos.coffee; done
coffee --compile $(BUILDDIR)/scripts/antos.coffee
- rm $(BUILDDIR)/scripts/antos.coffee
libs:
2017-08-26 16:50:13 +02:00
@echo "$(BLUE)Copy lib files$(NC)"
2017-08-14 00:20:19 +02:00
cp -rf src/libs/* $(BUILDDIR)/scripts/
2017-08-11 01:58:46 +02:00
schemes:
2017-08-26 16:50:13 +02:00
@echo "$(BLUE)Copy schemes files$(NC)"
2017-08-11 01:58:46 +02:00
- mkdir -p $(BUILDDIR)/resources/schemes
cp src/core/schemes/* $(BUILDDIR)/resources/schemes/
2017-08-26 16:50:13 +02:00
testdata:
@echo "$(BLUE)Copy JSON test files$(NC)"
- mkdir -p $(BUILDDIR)/resources/jsons
cp src/core/handlers/jsons/* $(BUILDDIR)/resources/jsons
build_tags:
2017-08-26 16:50:13 +02:00
@echo "$(BLUE)Building tag files$(NC)"
-mkdir $(BUILDDIR)/resources
2017-08-11 01:58:46 +02:00
-rm $(BUILDDIR)/resources/antos_tags.js
2020-02-21 17:56:45 +01:00
for f in src/core/tags/*.tag; do (cat "$${f}"; echo) >> $(BUILDDIR)/resources/antos_tags.js; done
2017-08-11 01:58:46 +02:00
2018-03-10 01:05:34 +01:00
languages:
-mkdir $(BUILDDIR)/resources
-mkdir $(BUILDDIR)/resources/languages
cp src/core/languages/*.json $(BUILDDIR)/resources/languages/
genlang:
read -r -p "Enter locale: " LOCAL;\
./src/core/languages/gen.sh ./src ./src/core/languages/$$LOCAL.json
build_themes: antos_themes_build
cp -r src/themes/system $(BUILDDIR)/resources/themes/
2017-08-11 01:58:46 +02:00
antos_themes_build:
2017-08-26 16:50:13 +02:00
@echo "$(BLUE)Building themes name: antos$(NC)"
2017-08-14 00:20:19 +02:00
-rm -rf $(BUILDDIR)/resources/themes/antos/*
2017-08-11 01:58:46 +02:00
-mkdir -p $(BUILDDIR)/resources/themes/antos
2017-08-17 00:42:05 +02:00
for f in src/themes/antos/*.css; do (cat "$${f}"; echo) >> $(BUILDDIR)/resources/themes/antos/antos.css;done
2017-08-11 01:58:46 +02:00
-mkdir -p $(BUILDDIR)/resources/themes/antos/fonts
cp -rf src/themes/antos/fonts/* $(BUILDDIR)/resources/themes/antos/fonts
2018-02-19 18:54:51 +01:00
cp src/themes/antos/wp* $(BUILDDIR)/resources/themes/antos/
2017-08-11 01:58:46 +02:00
2017-08-14 00:20:19 +02:00
build_packages:
2017-08-11 01:58:46 +02:00
- mkdir $(BUILDDIR)/packages
2017-08-15 02:56:04 +02:00
- for d in $(packages); do ( test -d $(BUILDDIR)/packages/$$d && rm -rf $(BUILDDIR)/packages/$$d/* ); done
2017-08-14 00:20:19 +02:00
for d in $(packages); do (cd src/packages/$$d; make);done
for d in $(packages); do ( test -d $(BUILDDIR)/packages/$$d || mkdir -p $(BUILDDIR)/packages/$$d && cp -rf src/packages/$$d/build/* $(BUILDDIR)/packages/$$d/);done
for d in $(packages); do ( test -d src/packages/$$d/build && rm -r src/packages/$$d/build ); done
2018-02-13 04:59:08 +01:00
package:
read -r -p "Enter package name: " PKG;\
test -d $(BUILDDIR)/packages/$$PKG && rm -rf $(BUILDDIR)/packages/$$PKG/*;\
cd src/packages/$$PKG && make;\
cd ../../../;\
test -d $(BUILDDIR)/packages/$$PKG || mkdir -p $(BUILDDIR)/packages/$$PKG;\
2020-02-21 17:56:45 +01:00
cp -rfv src/packages/$$PKG/build/* $(BUILDDIR)/packages/$$PKG/;\
2018-02-13 04:59:08 +01:00
test -d src/packages/$$PKG/build && rm -r src/packages/$$PKG/build;
2018-03-13 18:05:33 +01:00
pkgar:
read -r -p "Enter package name: " PKG;\
echo $$PKG | make package &&\
test -f $(BUILDDIR)/packages/$$PKG/main.js && uglifyjs $(BUILDDIR)/packages/$$PKG/main.js --compress --mangle --output $(BUILDDIR)/packages/$$PKG/main.js;\
2018-03-15 22:36:38 +01:00
test -f $(BUILDDIR)/packages/$$PKG/main.css && uglifycss --output $(BUILDDIR)/packages/$$PKG/main.css $(BUILDDIR)/packages/$$PKG/main.css;\
2018-03-13 18:05:33 +01:00
cd $(BUILDDIR)/packages/$$PKG && zip -r "$$PKG.zip" ./ ; \
2019-06-13 11:06:38 +02:00
cd ../../ && (test -d repo/$$PKG || mkdir repo/$$PKG) && mv packages/$$PKG/"$$PKG.zip" repo/$$PKG && touch repo/$$PKG/$$PKG.md && rm -r packages/$$PKG
2018-02-28 18:44:27 +01:00
uglify:
# uglify antos.js
2019-12-15 12:11:19 +01:00
# npm install uglify-es -g
2018-02-28 18:44:27 +01:00
# npm install uglify-js -g
uglifyjs $(BUILDDIR)/scripts/antos.js --compress --mangle --output $(BUILDDIR)/scripts/antos.js
# uglify tags
2019-12-15 12:11:19 +01:00
# npm install riot-cli -g
2018-02-28 18:44:27 +01:00
riot --ext js $(BUILDDIR)/resources/antos_tags.js $(BUILDDIR)/resources/antos_tags.js
uglifyjs $(BUILDDIR)/resources/antos_tags.js --compress --mangle --output $(BUILDDIR)/resources/antos_tags.js
2018-03-15 22:36:38 +01:00
$(GSED) -i 's/resources\/antos_tags.js/scripts\/riot.min.js/g' $(BUILDDIR)/index.html
$(GSED) -i 's/scripts\/riot.compiler.min.js/resources\/antos_tags.js/g' $(BUILDDIR)/index.html
$(GSED) -i 's/type=\"riot\/tag\"/ /g' "$(BUILDDIR)/index.html"
# npm install uglifycss -g
2018-02-28 18:44:27 +01:00
# uglify the css
2018-03-15 22:36:38 +01:00
uglifycss --output $(BUILDDIR)/resources/themes/antos/antos.css $(BUILDDIR)/resources/themes/antos/antos.css
uglifycss --output $(BUILDDIR)/resources/themes/system/font-awesome.css $(BUILDDIR)/resources/themes/system/font-awesome.css
2018-02-28 18:44:27 +01:00
#uglify each packages
for d in $(packages); do\
2018-03-15 22:36:38 +01:00
echo "Uglifying $$d";\
2018-02-28 18:44:27 +01:00
test -f $(BUILDDIR)/packages/$$d/main.js && uglifyjs $(BUILDDIR)/packages/$$d/main.js --compress --mangle --output $(BUILDDIR)/packages/$$d/main.js;\
2018-03-15 22:36:38 +01:00
test -f $(BUILDDIR)/packages/$$d/main.css && uglifycss --output $(BUILDDIR)/packages/$$d/main.css $(BUILDDIR)/packages/$$d/main.css;\
2018-02-28 18:44:27 +01:00
done
release: main uglify
2017-08-11 01:58:46 +02:00
clean:
2020-02-27 18:06:05 +01:00
rm -rf $(BUILDDIR)/resources
rm -rf $(BUILDDIR)/scripts
rm -rf $(BUILDDIR)/packages
rm -rf $(BUILDDIR)/index.html