2017-08-11 01:58:46 +02:00
2020-06-10 11:15:01 +02:00
BUILDDIR ?= /opt/www/htdocs/os
2020-06-24 19:53:28 +02:00
DOCDIR ?= /opt/www/htdocs/doc/antos
2017-08-14 00:20:19 +02:00
BLUE = \0 33[ 1; 34m
2017-08-11 01:58:46 +02:00
NC = \0 33[ 0m
2021-10-24 00:27:17 +02:00
TSC = ./node_modules/typescript/bin/tsc
UGLIFYJS = ./node_modules/terser/bin/terser
UGLIFYCSS = ./node_modules/uglifycss/uglifycss
2017-08-11 01:58:46 +02:00
2022-12-08 14:57:14 +01:00
VERSION = 2.0.0
BRANCH = a
2022-07-22 20:17:47 +02:00
BUILDID = $( shell git rev-parse --short HEAD)
2020-11-19 17:39:30 +01:00
2018-03-15 22:36:38 +01:00
GSED = sed
UNAME_S := $( shell uname -s)
i f e q ( $( UNAME_S ) , D a r w i n )
GSED = gsed
e n d i f
2020-09-18 13:20:22 +02:00
tags = dist/core/tags/tag.js \
dist/core/tags/WindowTag.js \
dist/core/tags/TileLayoutTags.js \
dist/core/tags/ResizerTag.js \
dist/core/tags/LabelTag.js \
dist/core/tags/ButtonTag.js \
dist/core/tags/ListViewTag.js \
dist/core/tags/SwitchTag.js \
dist/core/tags/NSpinnerTag.js \
dist/core/tags/GridViewTag.js \
dist/core/tags/TabBarTag.js \
dist/core/tags/TabContainerTag.js \
dist/core/tags/TreeViewTag.js \
dist/core/tags/SliderTag.js \
dist/core/tags/FloatListTag.js \
dist/core/tags/CalendarTag.js \
dist/core/tags/ColorPickerTag.js \
dist/core/tags/FileViewTag.js \
dist/core/tags/OverlayTag.js \
dist/core/tags/AppDockTag.js \
2021-11-26 00:03:01 +01:00
dist/core/tags/SystemPanelTag.js \
2022-12-08 14:50:38 +01:00
dist/core/tags/DesktopTag.js \
2022-12-09 13:17:35 +01:00
dist/core/tags/StackMenuTag.js \
2022-12-09 18:20:31 +01:00
dist/core/tags/StackPanelTag.js \
2023-01-06 18:44:11 +01:00
dist/core/tags/InputTag.js \
dist/core/tags/NotificationTag.js
2018-03-15 22:36:38 +01:00
2020-05-29 22:22:00 +02:00
javascripts = dist/core/core.js \
dist/core/settings.js \
dist/core/handles/RemoteHandle.js \
dist/core/Announcerment.js \
dist/core/vfs.js \
dist/core/db.js \
dist/core/BaseModel.js \
dist/core/BaseApplication.js \
dist/core/BaseService.js \
dist/core/BaseDialog.js \
2020-09-18 13:20:22 +02:00
$( tags) \
2020-05-29 22:22:00 +02:00
dist/core/gui.js \
dist/core/pm.js \
dist/bootstrap.js
2020-09-18 13:20:22 +02:00
antfx = $( tags) \
dist/core/Announcerment.js
2017-08-17 00:42:05 +02:00
2023-01-06 18:44:11 +01:00
packages = SystemServices SystemReport Files MarketPlace Setting NotePad
2017-08-14 00:20:19 +02:00
2020-05-24 13:17:59 +02:00
main : initd build_javascripts build_themes libs build_packages languages
2017-08-11 01:58:46 +02:00
- cp src/index.html $( BUILDDIR) /
2022-07-22 20:35:21 +02:00
- cp README.md $( BUILDDIR) /
2017-08-11 01:58:46 +02:00
2018-03-19 10:59:45 +01:00
initd :
- mkdir -p $( BUILDDIR)
2020-05-24 13:17:59 +02:00
lite : build_javascripts build_themes build_packages
2017-08-11 01:58:46 +02:00
#%.js: %.coffee
2020-09-18 13:20:22 +02:00
# coffee --compile $<
2017-08-11 01:58:46 +02:00
2020-09-18 13:20:22 +02:00
ts :
2020-05-29 22:22:00 +02:00
-rm -rf dist
2021-10-24 00:27:17 +02:00
$( TSC) -p tsconfig.json
2021-04-18 18:58:00 +02:00
cat ` find dist/core/ -name "*.d.ts" ` > d.ts/antos.d.ts
2021-04-12 21:39:28 +02:00
rm ` find dist/ -name "*.d.ts" `
2021-04-18 20:56:17 +02:00
cat d.ts/core.d.ts d.ts/jquery.d.ts d.ts/antos.d.ts > /tmp/corelib.d.ts
#-rm src/packages/CodePad/libs/corelib.d.ts.zip
#zip -j src/packages/CodePad/libs/corelib.d.ts.zip /tmp/corelib.d.ts
2020-09-18 13:20:22 +02:00
standalone_tags : ts
@echo " $( BLUE) Bundling standalone tags files $( NC) "
- mkdir -p $( BUILDDIR)
- rm $( BUILDDIR) /afx*
#echo "(function() {" > $(BUILDDIR)/scripts/antos.js
for f in $( antfx) ; do \
( cat " $$ {f} " ; echo ) >> dist/afx.js; \
rm " $$ {f} " ; \
done
echo "var Ant=this;" >> dist/afx.js
2021-10-24 00:27:17 +02:00
$( UGLIFYJS) dist/afx.js --compress --mangle --output $( BUILDDIR) /afx.js
2020-09-18 13:20:22 +02:00
# standalone theme
@for f in src/themes/system/afx-*.css; do \
if [ " $$ f " != "src/themes/system/antos.css" ] ; then \
echo " $$ f " ; \
( cat " $$ {f} " ; echo ) >> $( BUILDDIR) /afx.css; \
fi ; \
done
@for f in src/themes/antos_light/afx-*.css; do \
if [ " $$ f " != "src/themes/antos_light/antos.css" ] ; then \
echo " $$ f " ; \
( cat " $$ {f} " ; echo ) >> $( BUILDDIR) /afx.css; \
fi ; \
done
2021-10-24 00:27:17 +02:00
# $(UGLIFYCSS) --output $(BUILDDIR)/afx.css $(BUILDDIR)/afx.css
2020-09-18 13:20:22 +02:00
rm -r dist/core
build_javascripts : ts
2020-05-24 13:17:59 +02:00
@echo " $( BLUE) Bundling javascript files $( NC) "
2020-06-26 01:17:02 +02:00
- mkdir -p $( BUILDDIR) /scripts
2017-08-11 01:58:46 +02:00
- rm $( BUILDDIR) /scripts/antos.js
2020-05-29 22:22:00 +02:00
#echo "(function() {" > $(BUILDDIR)/scripts/antos.js
for f in $( javascripts) ; do \
( cat " $$ {f} " ; echo ) >> dist/antos.js; \
rm " $$ {f} " ; \
done
2022-07-22 20:19:10 +02:00
echo 'OS.VERSION.version_string = "$(VERSION)-$(BRANCH)-$(BUILDID)";' >> dist/antos.js
2020-05-29 22:22:00 +02:00
cp dist/antos.js $( BUILDDIR) /scripts/
echo "if(exports){ exports.__esModule = true;exports.OS = OS; }" >> dist/antos.js
rm -r dist/core
2017-08-11 01:58:46 +02:00
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
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
2017-08-11 01:58:46 +02:00
2018-03-10 01:05:34 +01:00
languages :
2020-05-05 17:52:54 +02:00
-mkdir -p $( BUILDDIR) /resources
-mkdir -p $( BUILDDIR) /resources/languages
2018-03-10 01:05:34 +01:00
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
2020-05-18 18:53:59 +02:00
build_themes : antos_light antos_dark
2020-05-13 19:03:39 +02:00
-rm -rf $( BUILDDIR) /resources/themes/system/*
-mkdir -p $( BUILDDIR) /resources/themes/system
cp -r src/themes/system/fonts $( BUILDDIR) /resources/themes/system
2023-01-01 22:03:00 +01:00
cp -r src/themes/system/icons $( BUILDDIR) /resources/themes/system
2020-05-13 19:03:39 +02:00
cp -r src/themes/system/wp $( BUILDDIR) /resources/themes/system
for f in src/themes/system/*.css; do ( cat " $$ {f} " ; echo ) >> $( BUILDDIR) /resources/themes/system/system.css; done
2017-08-11 01:58:46 +02:00
2020-05-18 18:53:59 +02:00
antos_light :
@echo " $( BLUE) Building themes name: antos-light $( NC) "
-rm -rf $( BUILDDIR) /resources/themes/antos_light/*
-mkdir -p $( BUILDDIR) /resources/themes/antos_light
for f in src/themes/antos_light/*.css; do ( cat " $$ {f} " ; echo ) >> $( BUILDDIR) /resources/themes/antos_light/antos_light.css; done
antos_dark :
@echo " $( BLUE) Building themes name: antos-dark $( NC) "
-rm -rf $( BUILDDIR) /resources/themes/antos_dark/*
-mkdir -p $( BUILDDIR) /resources/themes/antos_dark
for f in src/themes/antos_dark/*.css; do ( cat " $$ {f} " ; echo ) >> $( BUILDDIR) /resources/themes/antos_dark/antos_dark.css; done
2017-08-11 01:58:46 +02:00
2017-08-14 00:20:19 +02:00
build_packages :
2020-05-05 17:52:54 +02:00
- mkdir -p $( 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 && \
2021-10-24 00:27:17 +02:00
test -f $( BUILDDIR) /packages/$$ PKG/main.js && $( UGLIFYJS) $( BUILDDIR) /packages/$$ PKG/main.js --compress --mangle --output $( BUILDDIR) /packages/$$ PKG/main.js; \
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 :
2021-10-24 00:27:17 +02:00
# sudo npm install $(UGLIFYJS) -g
2022-07-19 20:57:12 +02:00
#
mv $( BUILDDIR) /scripts/antos.js $( BUILDDIR) /scripts/antos_src.js
cp $( BUILDDIR) /scripts/antos_src.js ./
$( UGLIFYJS) antos_src.js --compress --mangle --output antos.js --source-map "url='antos.js.map'"
mv antos.js* $( BUILDDIR) /scripts/
rm antos_src.js
2018-02-28 18:44:27 +01:00
# uglify tags
2021-10-24 00:27:17 +02:00
# npm install $(UGLIFYCSS) -g
2018-02-28 18:44:27 +01:00
# uglify the css
2021-10-24 00:27:17 +02:00
$( UGLIFYCSS) --output $( BUILDDIR) /resources/themes/antos_light/antos_light.css $( BUILDDIR) /resources/themes/antos_light/antos_light.css
$( UGLIFYCSS) --output $( BUILDDIR) /resources/themes/antos_dark/antos_dark.css $( BUILDDIR) /resources/themes/antos_dark/antos_dark.css
$( UGLIFYCSS) --output $( BUILDDIR) /resources/themes/system/system.css $( BUILDDIR) /resources/themes/system/system.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 " ; \
2022-07-19 20:57:12 +02:00
test -f $( BUILDDIR) /packages/$$ d/main.js && \
$( UGLIFYJS) $( BUILDDIR) /packages/$$ d/main.js \
--compress --mangle --output $( BUILDDIR) /packages/$$ d/main.js; \
2021-10-24 00:27:17 +02: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
2020-11-19 17:39:30 +01:00
ar :
-[ -d /tmp/antos-$( VERSION) ] && rm -r /tmp/antos-$( VERSION)
-[ -f /tmp/antos-$( VERSION) .tar.gz ] && rm /tmp/antos-$( VERSION) .tar.gz
mkdir /tmp/antos-$( VERSION)
BUILDDIR = /tmp/antos-$( VERSION) make release
cd /tmp/antos-$( VERSION) && tar cvzf ../antos-$( VERSION) .tar.gz .
mv /tmp/antos-$( VERSION) .tar.gz release/
2021-03-24 11:43:49 +01:00
echo -n $( VERSION) > release/latest
2020-11-19 17:39:30 +01:00
2018-02-28 18:44:27 +01:00
release : main uglify
2023-01-02 10:55:34 +01:00
.PHONY : doc release clean
2020-06-10 11:15:01 +02:00
doc :
2023-05-30 13:08:30 +02:00
# npm install typedoc --save-dev
# npm install typedoc-plugin-merge-modules --save-dev
# ./node_modules/.bin/typedoc --mode file --excludeNotExported --hideGenerator --name "AntOS $(VERSION)-$(BRANCH)-$(BUILDID) API" --out $(DOCDIR)
./node_modules/.bin/typedoc --hideGenerator --plugin typedoc-plugin-merge-modules --entryPointStrategy expand --name " AntOS $( VERSION) - $( BRANCH) - $( BUILDID) API " --out $( DOCDIR)
2020-06-10 11:15:01 +02:00
2020-09-24 18:22:16 +02:00
test : build_javascripts
2020-06-22 12:01:05 +02:00
jest
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