2025-01-18 08:30:18 +00:00
|
|
|
WEB_BUILD_DIR = htdocs
|
|
|
|
|
|
|
|
PACKAGE_JSON = package-lock.json \
|
|
|
|
package.json
|
|
|
|
|
2025-02-02 09:33:52 +00:00
|
|
|
WEB_DIRS = @WEBSRC_SUBDIRS@
|
|
|
|
|
|
|
|
WEB_FILES = @WEBSRC_SOURCE_FILES@
|
2025-01-18 08:30:18 +00:00
|
|
|
|
|
|
|
EXTRA_DIST = $(WEB_FILES) htdocs
|
|
|
|
|
2025-02-02 09:33:52 +00:00
|
|
|
# Build the Vue.js application
|
|
|
|
htdocs: $(WEB_FILES)
|
2025-01-18 08:30:18 +00:00
|
|
|
@if [ "$(abs_srcdir)" = "$(abs_builddir)" ]; then \
|
|
|
|
echo "In-tree build detected"; \
|
|
|
|
else \
|
|
|
|
echo "Out-of-tree build detected, copy source files to build dir"; \
|
|
|
|
for dir in $(WEB_DIRS); do \
|
|
|
|
dest_dir="$(abs_builddir)/$$dir"; \
|
|
|
|
mkdir -p "$$dest_dir"; \
|
|
|
|
done; \
|
|
|
|
for file in $(WEB_FILES); do \
|
|
|
|
src_path="$(abs_srcdir)/$$file"; \
|
|
|
|
dest_path="$(abs_builddir)/$$file"; \
|
|
|
|
cp "$$src_path" "$$dest_path"; \
|
|
|
|
done; \
|
|
|
|
fi
|
2025-02-02 09:33:52 +00:00
|
|
|
$(if $(BUILD_WEBINTERFACE),$(NPM) clean-install --no-progress --no-audit)
|
2025-01-28 19:21:08 +00:00
|
|
|
$(if $(BUILD_WEBINTERFACE),$(NPM) run build)
|
2025-01-18 08:30:18 +00:00
|
|
|
|
2025-02-02 09:33:52 +00:00
|
|
|
all-local: htdocs
|
|
|
|
|
|
|
|
install-data-local:
|
|
|
|
mkdir -p $(DESTDIR)$(datadir)/owntone/htdocs
|
|
|
|
cp -r $(WEB_BUILD_DIR)/* $(DESTDIR)$(datadir)/owntone/htdocs
|
|
|
|
|
|
|
|
uninstall-local:
|
|
|
|
rm -rf $(DESTDIR)$(datadir)/owntone/htdocs
|
|
|
|
|
|
|
|
# Clean up Vue.js build artifacts
|
|
|
|
clean-local:
|
|
|
|
$(if $(BUILD_WEBINTERFACE),rm -rf $(WEB_BUILD_DIR))
|
|
|
|
|
|
|
|
distclean-local:
|
|
|
|
@if [ "$(abs_srcdir)" != "$(abs_builddir)" ]; then \
|
|
|
|
echo "Cleaning up copied files from out-of-tree build..."; \
|
|
|
|
for file in $(WEB_FILES); do \
|
|
|
|
rm -f "$(abs_builddir)/$$file"; \
|
|
|
|
done; \
|
|
|
|
fi
|
|
|
|
rm -rf node_modules
|
|
|
|
|
|
|
|
node_modules: $(PACKAGE_JSON)
|
|
|
|
$(if $(BUILD_WEBINTERFACE),$(NPM) clean-install --no-progress --no-audit)
|
|
|
|
|
|
|
|
web: node_modules $(WEB_FILES)
|
|
|
|
$(if $(BUILD_WEBINTERFACE),$(NPM) run build)
|
2025-01-18 08:30:18 +00:00
|
|
|
|
|
|
|
web-serve: node_modules
|
2025-01-28 19:21:08 +00:00
|
|
|
$(if $(BUILD_WEBINTERFACE),$(NPM) run serve)
|
2025-01-18 08:30:18 +00:00
|
|
|
|
|
|
|
web-update:
|
2025-01-28 19:21:08 +00:00
|
|
|
$(if $(BUILD_WEBINTERFACE),$(NPM) update)
|
2025-01-18 08:30:18 +00:00
|
|
|
|
2025-01-18 19:21:02 +00:00
|
|
|
web-check:
|
|
|
|
@echo "Verifying that all source files in 'src' and 'public' are listed in WEB_FILES ..."
|
|
|
|
@unexpected_files=0; \
|
|
|
|
for file in $$(find public src -type f); do \
|
|
|
|
if ! echo " $(WEB_FILES) " | grep -q " $$file "; then \
|
|
|
|
echo "Unknown web interface source file found: $$file"; \
|
|
|
|
unexpected_files=1; \
|
|
|
|
fi; \
|
|
|
|
done; \
|
|
|
|
if [ $$unexpected_files -eq 0 ]; then \
|
|
|
|
echo "All source files listed in WEB_FILES."; \
|
|
|
|
else \
|
|
|
|
echo "FAILURE: Unknown web interface source files found, please add them to WEB_FILES."; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
|
2025-01-18 08:30:18 +00:00
|
|
|
web-lint: node_modules
|
2025-01-28 19:21:08 +00:00
|
|
|
$(if $(BUILD_WEBINTERFACE),$(NPM) run lint --no-fix)
|
2025-01-18 08:30:18 +00:00
|
|
|
|
|
|
|
web-format: node_modules
|
2025-01-28 19:21:08 +00:00
|
|
|
$(if $(BUILD_WEBINTERFACE),$(NPM) run format)
|
2025-01-18 08:30:18 +00:00
|
|
|
|