|
| 1 | +VCPKG_REPO = https://github.com/microsoft/vcpkg.git |
| 2 | +PREFIX ?= /usr/local |
| 3 | + |
| 4 | +all: install |
| 5 | + |
| 6 | +install: build |
| 7 | + @echo "Installing node-filerix..." |
| 8 | + cmake --install build --prefix=$(PREFIX) || { echo "Installation failed"; exit 1; } |
| 9 | + chrpath --delete ./build/filerix.node || echo "No RPATH to remove" |
| 10 | + @echo "Installation complete!" |
| 11 | + |
| 12 | +build: check-vcpkg setup-vcpkg-port |
| 13 | + @echo "Bootstrapping vcpkg..." |
| 14 | + ./vcpkg/bootstrap-vcpkg.sh || { echo "Failed to bootstrap vcpkg"; exit 1; } |
| 15 | + @echo "Installing dependencies with vcpkg..." |
| 16 | + ./vcpkg/vcpkg --feature-flags=manifests install --triplet x64-linux-release || { echo "Failed to install dependencies"; exit 1; } |
| 17 | + @echo "Generating build files with CMake..." |
| 18 | + mkdir -p build && cd build && cmake .. || { echo "Failed to generate CMake build files"; exit 1; } |
| 19 | + @echo "Building the project..." |
| 20 | + cmake --build build --parallel || { echo "Build failed"; exit 1; } |
| 21 | + @echo "Build complete!" |
| 22 | + |
| 23 | +setup-vcpkg-port: |
| 24 | + @if [ ! -d "./vcpkg/ports/filerix" ]; then \ |
| 25 | + echo "Downloading filerix vcpkg port..."; \ |
| 26 | + git clone --recurse-submodules https://github.com/filesverse/vcpkg-port.git vcpkg-port || { echo "Failed to download filerix vcpkg port"; exit 1; }; \ |
| 27 | + echo "Copying filerix vcpkg port..."; \ |
| 28 | + mv ./vcpkg-port ./vcpkg/ports/filerix || { echo "Failed to copy filerix vcpkg port"; exit 1; }; \ |
| 29 | + fi |
| 30 | + |
| 31 | +check-vcpkg: |
| 32 | + @if [ ! -d "./vcpkg" ] || [ -z "$$(ls -A ./vcpkg 2>/dev/null)" ]; then \ |
| 33 | + echo "vcpkg is missing or empty. Cloning vcpkg..."; \ |
| 34 | + git clone $(VCPKG_REPO) vcpkg || { echo "Failed to clone vcpkg"; exit 1; }; \ |
| 35 | + fi |
| 36 | + |
| 37 | +uninstall: |
| 38 | + @echo "Removing installed files..." |
| 39 | + rm -f $(PREFIX)/lib64/node_modules/filerix.node |
| 40 | + @echo "Uninstallation complete!" |
| 41 | + |
| 42 | +clean: |
| 43 | + @echo "Cleaning build directory..." |
| 44 | + rm -rf build vcpkg_installed vcpkg-port |
| 45 | + @echo "Clean complete!" |
| 46 | + |
| 47 | +.PHONY: all install build uninstall clean |
0 commit comments