chore: initialize project scaffold with Makefile, .gitignore, README, and rproc.service
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# Makefile for rproc
|
||||
|
||||
CC = gcc
|
||||
# Compiling with optimizations and all warnings enabled for robustness.
|
||||
CFLAGS = -Wall -Wextra -O2 -std=c11
|
||||
# No special libraries needed for linking.
|
||||
LDFLAGS =
|
||||
TARGET = rproc
|
||||
|
||||
.PHONY: all clean install uninstall
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): main.c
|
||||
$(CC) $(CFLAGS) -o $(TARGET) main.c $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET) *.log
|
||||
|
||||
# Installs the application and the systemd service file.
|
||||
# Requires sudo privileges.
|
||||
install: $(TARGET)
|
||||
@echo "Installing rproc binary to /usr/local/bin..."
|
||||
sudo cp $(TARGET) /usr/local/bin/
|
||||
@echo "Installing systemd service file to /etc/systemd/system..."
|
||||
sudo cp rproc.service /etc/systemd/system/
|
||||
@echo "Reloading systemd daemon..."
|
||||
sudo systemctl daemon-reload
|
||||
@echo "Installation complete."
|
||||
@echo "IMPORTANT: Please edit /etc/systemd/system/rproc.service and set the correct WorkingDirectory."
|
||||
@echo "Then run 'sudo systemctl daemon-reload' again."
|
||||
|
||||
# Uninstalls the application and the systemd service file.
|
||||
# Requires sudo privileges.
|
||||
uninstall:
|
||||
@echo "Stopping and disabling rproc service..."
|
||||
sudo systemctl stop rproc.service || true
|
||||
sudo systemctl disable rproc.service || true
|
||||
@echo "Removing rproc binary from /usr/local/bin..."
|
||||
sudo rm -f /usr/local/bin/rproc
|
||||
@echo "Removing systemd service file..."
|
||||
sudo rm -f /etc/systemd/system/rproc.service
|
||||
@echo "Reloading systemd daemon..."
|
||||
sudo systemctl daemon-reload
|
||||
@echo "Uninstallation complete."
|
||||
Reference in New Issue
Block a user