f7
f7 is a spreadsheet formula execution library
git clone https://git.vogt.world/f7.git
Log | Files | README.md | LICENSE.md
← All files
name: Makefile
-rw-r--r--
2391
 1# ==================================================================================================
 2# The makefile for every buildable thing, and most development tasks inside this repo.
 3#
 4# All buildable things have a `build-X` target that builds the conceptual thing (eg: app, service,
 5# library), while the targets that make up that thing are named according to their literal
 6# target path.
 7# ==================================================================================================
 8
 9PWD := $(shell pwd)
10OS ?= darwin
11ARCH ?= arm64
12ENV ?= dev
13
14YARNCMD := yarn
15YARNINSTALL := $(YARNCMD) install
16
17ESLINT := ./node_modules/eslint/bin/eslint.js . --ext=.ts,.tsx --fix
18PRETTIER := ./node_modules/prettier/bin-prettier.js --write '**/(*.css|*.js|*.ts|*.jsx|*.tsx|*.md)'
19
20.PHONY: all
21
22# ==================================================================================================
23# all
24# ==================================================================================================
25build-all: \
26  build-ts
27	@# intentionally blank, proxy for prerequisite.
28
29all: clean \
30  fmt \
31  deps \
32  build-all
33
34ts_target_files := target/f7.js
35ts_target_test_files := target/f7_test.js
36ts_source_files := $(wildcard src/**.*)
37grammar_source_files := $(wildcard src/main/g4**.*)
38
39build-grammars: $(grammar_source_files)
40	cd src/main/g4 && \
41        antlr4 F7.g4 -o ../java/io/protobase/f7/antlr -visitor -package io.protobase.f7.antlr && \
42        antlr4 F7.g4 -o ../js/antlr -visitor -Dlanguage=JavaScript
43
44build-ts: $(ts_target_files)
45	@# intentionally blank, proxy for prerequisite.
46
47test-ts: $(ts_target_test_files)
48	node target/f7_test.js
49
50$(ts_target_files): $(ts_source_files)
51	esbuild \
52		src/main/js/Export.ts \
53		--bundle \
54		--outfile=target/f7.js \
55		--format=iife \
56		--platform=node \
57		--target=esnext
58
59$(ts_target_test_files): $(ts_source_files)
60	esbuild \
61		src/test/js/Index.ts \
62		--bundle \
63		--external:"antlr4/index" \
64		--outfile=target/f7_test.js \
65		--platform=node
66
67deps:
68	$(YARNINSTALL)
69
70fmt:
71	$(ESLINT)
72	$(PRETTIER)
73
74clean:
75	rm -rf target/*
76
77nuke: clean
78	rm -rf node_modules
79
80bootstrap-linux:
81	sudo apt-get update && \
82      sudo apt-get -y upgrade && \
83      sudo apt-get install make -y && \
84      sudo apt-get install npm -y && \
85      npm install --global yarn
86
87bootstrap-macos:
88	brew install watch && \
89      brew install node && \
90      brew install yarn