Skip to content

Commit

Permalink
Makefile refactor and cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
k0gen committed Mar 29, 2023
1 parent 68880b6 commit 85d0f8d
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
DOC_ASSETS := $(shell find ./docs/assets)
PKG_VERSION := $(shell cat manifest.json | jq -r '.version')
PKG_ID := $(shell cat manifest.json | jq -r '.id')
TS_FILES := $(shell find ./ -name \*.ts)
Expand All @@ -7,12 +6,17 @@ TS_FILES := $(shell find ./ -name \*.ts)

all: verify

# assumes /etc/embassy/config.yaml exists on local system with `host: "http://embassy-server-name.local"` configured
install: $(PKG_ID).s9pk
embassy-cli package install $(PKG_ID).s9pk

verify: $(PKG_ID).s9pk
embassy-sdk verify s9pk $(PKG_ID).s9pk
@embassy-sdk verify s9pk $(PKG_ID).s9pk
@echo " Done!"
@echo " Filesize: $(shell du -h $(PKG_ID).s9pk) is ready"

install:
ifeq (,$(wildcard ~/.embassy/config.yaml))
@echo; echo "You must define \"host: http://embassy-server-name.local\" in ~/.embassy/config.yaml config file first"; echo
else
embassy-cli package install $(PKG_ID).s9pk
endif

clean:
rm -rf docker-images
Expand All @@ -21,16 +25,28 @@ clean:
rm -f scripts/*.js

$(PKG_ID).s9pk: manifest.json LICENSE instructions.md icon.png scripts/embassy.js docker-images/x86_64.tar docker-images/aarch64.tar
if ! [ -z "$(ARCH)" ]; then cp docker-images/$(ARCH).tar image.tar; fi
embassy-sdk pack

docker-images/aarch64.tar: Dockerfile docker_entrypoint.sh manifest.json
ifeq ($(ARCH),aarch64)
@echo "embassy-sdk: Preparing aarch64 package ..."
else ifeq ($(ARCH),x86_64)
@echo "embassy-sdk: Preparing x86_64 package ..."
else
@echo "embassy-sdk: Preparing Universal Package ..."
endif
@embassy-sdk pack

docker-images/aarch64.tar: Dockerfile docker_entrypoint.sh manifest.json
ifeq ($(ARCH),x86_64)
else
mkdir -p docker-images
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --build-arg DB=sqlite --build-arg PLATFORM=arm64 --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --platform=linux/arm64/v8 -o type=docker,dest=docker-images/aarch64.tar -f Dockerfile .
endif

docker-images/x86_64.tar: Dockerfile docker_entrypoint.sh manifest.json
docker-images/x86_64.tar: Dockerfile docker_entrypoint.sh manifest.json
ifeq ($(ARCH),aarch64)
else
mkdir -p docker-images
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --build-arg DB=sqlite --build-arg PLATFORM=amd64 --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --platform=linux/amd64 -o type=docker,dest=docker-images/x86_64.tar -f Dockerfile .
endif

scripts/embassy.js: $(TS_FILES) scripts/generated/manifest.ts
deno bundle scripts/embassy.ts scripts/embassy.js
Expand Down

0 comments on commit 85d0f8d

Please sign in to comment.