Debian Codegraph @

ivette/Makefile

raw
1 ##########################################################################
2 # #
3 # This file is part of Frama-C. #
4 # #
5 # Copyright (C) 2007-2022 #
6 # CEA (Commissariat à l'énergie atomique et aux énergies #
7 # alternatives) #
8 # #
9 # you can redistribute it and/or modify it under the terms of the GNU #
10 # Lesser General Public License as published by the Free Software #
11 # Foundation, version 2.1. #
12 # #
13 # It is distributed in the hope that it will be useful, #
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16 # GNU Lesser General Public License for more details. #
17 # #
18 # See the GNU Lesser General Public License version 2.1 #
19 # for more details (enclosed in the file licenses/LGPLv2.1). #
20 # #
21 ##########################################################################
22
23 # --------------------------------------------------------------------------
24 APP=Ivette
25 DOME=./src/dome
26 DOME_ARGS=--command $$(dirname $$0)/../../bin/frama-c
27 DOME_DEV=-server-debug 1
28 DOME_CLI=./bin/ivette
29 DOME_API=./src/frama-c
30 DOME_CUSTOM_ENTRIES= yes
31 COPYRIGHT=CEA LIST / LSL
32 # --------------------------------------------------------------------------
33
34 .PHONY: all app dev pkg doc serve dist lint fixlint checkcase
35
36 all: pkg lint app
37
38 app: dome-app
39 dev: dome-dev
40 dist: dist-dir dome-dist
41
42 lint: dome-pkg dome-templ checkcase
43 @echo "[Ivette] running typechecker & linter"
44 yarn run typecheck
45 yarn run lint
46
47 # In case-insensitive filesystems (macOS/Windows), import statements and
48 # filenames can have issues due to case differences
49 checkcase:
50 @echo "[Ivette] check case issues in imported filenames"
51 @err=0 ; for f in `find src | sed -E 's/(.ts|.tsx|.js|.jsx|.css|.json)$$//' | sort -f | uniq -di` ;\
52 do \
53 err=1; \
54 echo " - ambiguous $$f.*"; \
55 done ;\
56 exit $$err
57
58 tsc: dome-pkg dome-templ
59 @echo "[Ivette] running typechecker & linter (with cache & fix mode)"
60 yarn run typecheck
61 yarn run lint --fix --cache --cache-location .eslint-cache
62
63 # --------------------------------------------------------------------------
64 # --- Ivette Package Loader
65 # --------------------------------------------------------------------------
66
67 LOADER=src/renderer/loader.ts
68 PACKAGES=$(shell find src -name "pkg.json")
69
70 lint: pkg
71 dome-pkg: pkg
72 dome-app: pkg
73 dome-dev: pkg
74 dome-dist: pkg
75 pkg: $(LOADER)
76 $(LOADER): $(PACKAGES) ./configure.js ./Makefile
77 @rm -f $(LOADER)
78 @echo "[Ivette] configure packages"
79 @node ./configure.js $(LOADER) $(PACKAGES)
80 @chmod -f a-w $(LOADER)
81
82 # --------------------------------------------------------------------------
83 # --- Frama-C Source Distrib
84 # --------------------------------------------------------------------------
85
86 .PHONY: update-distrib-files
87
88 update-distrib-files:
89 ./distrib.sh
90
91 # --------------------------------------------------------------------------
92 # --- Frama-C API
93 # --------------------------------------------------------------------------
94
95 .PHONY: api
96
97 api:
98 @echo "[Ivette] Generating TypeScript API"
99 @find src/frama-c -path "*/api/*" -name "*.ts" -exec rm -f {} \;
100 ../bin/frama-c.byte \
101 -load-module src/frama-c/api_generator.ml \
102 -server-tsc
103 @find src/frama-c -path "*/api/*" -name "*.ts" \
104 -exec headache \
105 -h ../headers/open-source/CEA_LGPL \
106 -c ../headers/headache_config.txt {} \;\
107 -exec chmod a-w {} \;
108
109 # --------------------------------------------------------------------------
110 # --- Ivette Documentation
111 # --------------------------------------------------------------------------
112
113 .PHONY: icons
114
115 VERSION=$(shell echo "console.log(require('./package.json').version)" | node -)
116
117 DOC_ICONS_CSS= src/dome/doc/gallery.css
118 DOC_ICONS_MAKE= src/dome/doc/iconsmd.js
119 DOC_ICONS_GALLERY= src/dome/doc/guides/icons.md
120 DOC_ICONS_DATA= src/dome/renderer/controls/gallery.json
121 DOC_GUIDES= src/dome/doc/guides
122
123 NODEBIN= ./node_modules/.bin
124
125 DOCDIRS= src/ivette src/dome/renderer src/dome/utils src/frama-c/api
126 DOCFILES= src/frama-c/server.ts src/frama-c/states.ts $(shell find $(DOCDIRS) -name "*.ts" -or -name "*.tsx")
127
128 icons: $(DOC_ICONS_GALLERY)
129
130 $(DOC_ICONS_GALLERY): $(DOC_ICONS_MAKE) $(DOC_ICONS_DATA)
131 @rm -f $@
132 @node $(DOC_ICONS_MAKE) $(DOC_ICONS_DATA) > src/dome/doc/guides/icons.md
133 @chmod a-w $@
134
135 doc: $(NODEBIN)/typedoc icons
136 @echo "\n[Ivette] documentation"
137 @rm -fr doc/html
138 @yarn run typedoc $(DOCFILES)
139 @echo "\n[Ivette] main page"
140 @echo ""
141 @echo " file://$(PWD)/ivette/doc/html/index.html"
142 @echo ""
143
144 $(NODEBIN)/%:
145 @echo "[Node] install package $*"
146 yarn add -D $*
147
148 # --------------------------------------------------------------------------
149 include $(DOME)/template/makefile
150 # --------------------------------------------------------------------------
151
152 # --------------------------------------------------------------------------
153 # --- Ivette Installation
154 # --------------------------------------------------------------------------
155
156 sinclude ../share/Makefile.config
157
158 dist-dir:
159 @echo "Cleaning dist"
160 @rm -fr dist
161
162 IVETTE_DIST=$(wildcard dist/linux-unpacked dist/mac dist/mac-arm64)
163
164 ifdef LIBDIR
165 ifdef BINDIR
166 ifeq ($(IVETTE_DIST),dist/linux-unpacked)
167
168 install:
169 @echo "Installing Ivette (Linux)"
170 @rm -fr $(LIBDIR)/ivette
171 @rm -f $(BINDIR)/ivette
172 @mv $(IVETTE_DIST) $(LIBDIR)/ivette
173 @ln -s $(LIBDIR)/ivette/ivette $(BINDIR)/ivette
174
175 else ifeq ($(IVETTE_DIST:-arm64=),dist/mac)
176
177 install:
178 @echo "Installing Ivette (macOS)"
179 @rm -fr /Applications/Ivette.app
180 @mv $(IVETTE_DIST)/Ivette.app /Applications/
181 @rm -fr $(IVETTE_DIST)
182 @install ivette-macos.sh $(BINDIR)/ivette
183
184 else
185
186 install:
187 @echo "No distribution to install"
188 @echo "use 'make dist' and retry"
189 @exit 1
190
191 endif
192 endif
193 endif
194
195 # --------------------------------------------------------------------------
196 # --- Ivette Un-Installation
197 # --------------------------------------------------------------------------
198
199 ifdef LIBDIR
200 ifdef BINDIR
201
202 uninstall:
203 @echo "Uninstall Ivette"
204 @rm -fr dist
205 @rm -fr /Applications/Ivette.app
206 @rm -fr $(LIBDIR)/ivette
207 @rm -f $(BINDIR)/ivette
208
209 endif
210 endif
211
212 # --------------------------------------------------------------------------