backend/tools/makefile

139 lines
4.4 KiB
Makefile
Raw Normal View History

2024-05-20 21:56:48 +02:00
# Espe | Ein schlichtes Werkzeug zur Mitglieder-Verwaltung | Backend
# Copyright (C) 2024 Christian Fraß
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
2024-04-22 10:02:34 +02:00
## consts
dir_lib := lib
dir_source := source
2024-08-21 15:18:10 +02:00
dir_temp := /tmp/espe-backend-temp
2024-04-22 10:02:34 +02:00
dir_build := build
dir_tools := tools
2024-04-22 10:02:34 +02:00
cmd_log := echo "--"
cmd_cat := cat
cmd_chmod := chmod
cmd_mkdir := mkdir -p
cmd_cp := cp
cmd_tsc := ${dir_tools}/typescript/node_modules/.bin/tsc
2024-04-22 10:02:34 +02:00
## rules
.PHONY: default
2024-05-10 19:40:02 +02:00
default: main
2024-04-22 10:02:34 +02:00
2024-05-12 11:30:43 +02:00
.PHONY: core
core: node_modules ${dir_temp}/espe-core.js ${dir_temp}/espe-core.d.ts
2024-04-22 10:02:34 +02:00
.PHONY: node_modules
node_modules:
2024-04-22 10:10:25 +02:00
@ ${cmd_mkdir} ${dir_build}/node_modules
2024-04-22 10:02:34 +02:00
@ ${cmd_log} "node modules …"
@ ${cmd_cp} -r -u ${dir_lib}/node/node_modules/* ${dir_build}/node_modules/
2024-05-10 19:40:02 +02:00
${dir_temp}/espe-core.js ${dir_temp}/espe-core.d.ts: \
${dir_lib}/plankton/plankton.d.ts \
${dir_source}/helpers.ts \
2024-06-20 15:13:58 +02:00
${dir_source}/helpers/password.ts \
2024-05-10 19:40:02 +02:00
${dir_source}/database.ts \
${dir_source}/types.ts \
2025-03-31 18:39:50 +00:00
${dir_source}/repositories/admin.ts \
2024-05-10 19:40:02 +02:00
${dir_source}/repositories/name_index.ts \
${dir_source}/repositories/member.ts \
2025-03-31 20:24:43 +00:00
${dir_source}/repositories/invite.ts \
${dir_source}/services/admin.ts \
2024-05-10 19:40:02 +02:00
${dir_source}/services/name_index.ts \
${dir_source}/services/member.ts \
2025-03-31 20:24:43 +00:00
${dir_source}/services/invite.ts \
2024-05-10 19:40:02 +02:00
${dir_source}/api/base.ts \
2024-06-03 01:28:13 +02:00
${dir_source}/api/actions/meta_ping.ts \
2024-05-21 19:58:00 +02:00
${dir_source}/api/actions/meta_spec.ts \
2024-05-10 19:40:02 +02:00
${dir_source}/api/actions/session_begin.ts \
${dir_source}/api/actions/session_end.ts \
${dir_source}/api/actions/member_project.ts \
${dir_source}/api/actions/member_summon.ts \
${dir_source}/api/actions/member_info.ts \
${dir_source}/api/actions/member_register.ts \
${dir_source}/api/actions/member_list.ts \
${dir_source}/api/actions/member_read.ts \
${dir_source}/api/actions/member_modify.ts \
2024-06-23 11:47:50 +02:00
${dir_source}/api/actions/member_delete.ts \
${dir_source}/api/actions/member_password_change_initialize.ts \
${dir_source}/api/actions/member_password_change_execute.ts \
2025-04-12 10:20:58 +00:00
${dir_source}/api/actions/invite_list.ts \
2025-03-31 20:24:43 +00:00
${dir_source}/api/actions/invite_create.ts \
${dir_source}/api/actions/invite_examine.ts \
${dir_source}/api/actions/invite_accept.ts \
2024-05-10 19:40:02 +02:00
${dir_source}/api/functions.ts \
${dir_source}/conf.ts
@ ${cmd_log} "compile | core …"
@ ${cmd_mkdir} $(dir $@)
@ ${cmd_tsc} --lib es2020 --strict $^ --outFile ${dir_temp}/espe-core.js --declaration
2024-05-10 19:40:02 +02:00
2024-05-12 11:30:43 +02:00
.PHONY: main
2024-06-03 12:33:15 +02:00
main: core ${dir_build}/espe data
2024-05-12 11:30:43 +02:00
2024-05-10 19:40:02 +02:00
${dir_temp}/espe-main-raw.js: \
${dir_lib}/plankton/plankton.d.ts \
${dir_temp}/espe-core.d.ts \
${dir_source}/sample.ts \
2024-05-10 19:40:02 +02:00
${dir_source}/main.ts
@ ${cmd_log} "compile | main …"
@ ${cmd_mkdir} $(dir $@)
2024-06-20 15:13:58 +02:00
@ ${cmd_tsc} --lib es2020 $^ --outFile $@
2024-05-10 19:40:02 +02:00
${dir_build}/espe: \
${dir_source}/head.js \
${dir_lib}/plankton/plankton.js \
${dir_temp}/espe-core.js \
${dir_temp}/espe-main-raw.js
@ ${cmd_log} "link | main …"
@ ${cmd_mkdir} $(dir $@)
@ ${cmd_cat} $^ > $@
@ ${cmd_chmod} +x $@
2024-05-12 11:30:43 +02:00
.PHONY: test
test: core ${dir_build}/test-data.json ${dir_build}/espe-test.mocha.js
${dir_build}/test-data.json: \
${dir_source}/test/data.json
@ ${cmd_log} "test | copy data …"
@ ${cmd_mkdir} $(dir $@)
@ ${cmd_cp} -r -u -v $^ $@
2024-05-12 11:30:43 +02:00
${dir_temp}/espe-test-raw.js: \
${dir_lib}/plankton/plankton.d.ts \
${dir_temp}/espe-core.d.ts \
${dir_lib}/node/node_modules/@types/mocha/index.d.ts \
${dir_source}/test/main.mocha.ts
2024-05-12 11:30:43 +02:00
@ ${cmd_log} "compile | test …"
@ ${cmd_mkdir} $(dir $@)
2024-06-20 15:13:58 +02:00
@ ${cmd_tsc} --lib es2020 $^ --outFile $@
2024-05-12 11:30:43 +02:00
2024-05-10 19:40:02 +02:00
${dir_build}/espe-test.mocha.js: \
${dir_source}/head.js \
${dir_lib}/plankton/plankton.js \
${dir_temp}/espe-core.js \
${dir_temp}/espe-test-raw.js
@ ${cmd_log} "link | test …"
2024-04-22 10:02:34 +02:00
@ ${cmd_mkdir} $(dir $@)
@ ${cmd_cat} $^ > $@
@ ${cmd_chmod} +x $@
2024-06-03 12:33:15 +02:00
.PHONY: data
data:
@ ${cmd_log} "data …"
@ ${cmd_mkdir} ${dir_build}/data
@ ${cmd_cp} -r -u -v ${dir_source}/data/* ${dir_build}/data/