| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- # Load configuration from ./configure
- include config.mk
- TARGET = visual-renamer
- SRC = src/main.cpp
- OBJ = $(SRC:.cpp=.o)
- # Default target
- all: check_config $(TARGET)
- # Check if config.mk exists
- check_config:
- @if [ ! -f config.mk ]; then \
- echo "Error: config.mk not found. Please run ./configure first."; \
- exit 1; \
- fi
- # Link the executable
- $(TARGET): $(OBJ)
- @echo "Linking $(TARGET)..."
- @$(CXX) $(OBJ) -o $(TARGET) $(LIBS)
- @echo "Build complete."
- # Compile source files
- .cpp.o:
- @echo "Compiling $<..."
- @$(CXX) $(CXXFLAGS) -c $< -o $@
- # Install to system
- install: all
- @echo "Installing to $(PREFIX)/bin..."
- @mkdir -p $(PREFIX)/bin
- @cp $(TARGET) $(PREFIX)/bin/
- @chmod 755 $(PREFIX)/bin/$(TARGET)
- @echo "creating desktop entry..."
- @mkdir -p $(HOME)/.local/share/applications
- @echo "[Desktop Entry]" > $(HOME)/.local/share/applications/visual-renamer.desktop
- @echo "Type=Application" >> $(HOME)/.local/share/applications/visual-renamer.desktop
- @echo "Name=Visual Renamer" >> $(HOME)/.local/share/applications/visual-renamer.desktop
- @echo "Exec=$(PREFIX)/bin/$(TARGET)" >> $(HOME)/.local/share/applications/visual-renamer.desktop
- @echo "Icon=system-file-manager" >> $(HOME)/.local/share/applications/visual-renamer.desktop
- @echo "Categories=Utility;" >> $(HOME)/.local/share/applications/visual-renamer.desktop
- @echo "Installation successful!"
- # Uninstall
- uninstall:
- @echo "Removing $(PREFIX)/bin/$(TARGET)..."
- @rm -f $(PREFIX)/bin/$(TARGET)
- @rm -f $(HOME)/.local/share/applications/visual-renamer.desktop
- @echo "Uninstall complete."
- # Clean build files
- clean:
- @echo "Cleaning up..."
- @rm -f $(OBJ) $(TARGET) config.mk
- .PHONY: all check_config install uninstall clean
|