kalasag.org

kalasag.org

Git

This commit has been accessed 5 times via Git panel.

commit 6c33e2c5f5577f554079bf22ec9f057849a409d9
tree 89d9746be280e441d1b38f79b297803c7f03ce5f
parent 1229ef93b92abd28420162846c3bc3e042ac9272
author Engels Antonio <engels@kalasag.org> 1782532971 +0800
committer Engels Antonio <engels@kalasag.org> 1782532971 +0800

    Makefile: add .PHONY, fix clean target, add install guard and daemon-reload
   
    - Declare .PHONY for all, clean, install, uninstall
    - Fix clean: use rm -f, clean *.o too
    - Fail install early if binary hasn't been built
    - Run systemctl daemon-reload after service install/uninstall

diff --git a/Makefile b/Makefile
index cd989e0..1503b30 100644
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,8 @@ BSD_CFLAGS = $(BASE_CFLAGS) -fPIE -Wl,-pie -fstack-protector-strong
 INSTALLDIR = /opt
 CHILDDIR=/kalasag
 
+.PHONY: all clean install uninstall
+
 all:
                @echo "Usage: make <systype>"
                @echo "<systype> is one of: linux, linux-x86_64, debian-linux, bsd, solaris, hpux, hpux-gcc,"
@@ -68,7 +70,7 @@ all:
                @echo ""
 
 clean:        
-               /bin/rm ./kalasag
+               /bin/rm -f ./kalasag *.o
 
 uninstall:    
                @for svc in kalasag-tcp kalasag-udp; do \
@@ -78,9 +80,14 @@ uninstall:
                        rm -f /usr/lib/systemd/system/$$svc.service; \
                    fi; \
                done
+               @systemctl daemon-reload 2>/dev/null || true
                @if [ -d $(INSTALLDIR)$(CHILDDIR) ]; then rm -rf $(INSTALLDIR)$(CHILDDIR)/*; fi
 
-install:      
+install:
+               @if [ ! -f ./kalasag ]; then \
+                   echo "Error: ./kalasag not found. Build first (e.g. make linux)"; \
+                   exit 1; \
+               fi
                @if [ ! -d $(INSTALLDIR)$(CHILDDIR) ]; then mkdir -p $(INSTALLDIR)$(CHILDDIR); fi
                @chmod 700 $(INSTALLDIR)$(CHILDDIR)
                @cp ./kalasag.conf $(INSTALLDIR)$(CHILDDIR)
@@ -89,6 +96,7 @@ install:
                @if [ -d /usr/lib/systemd/system ]; then \
                    cp ./kalasag-tcp.service /usr/lib/systemd/system/; \
                    cp ./kalasag-udp.service /usr/lib/systemd/system/; \
+                   systemctl daemon-reload; \
                    systemctl enable kalasag-tcp.service; \
                    systemctl enable kalasag-udp.service; \
                fi
 
filedropkalasag.git-8eed43a.tar.bz2 new
21.31 KB
2 downloads
filedropkalasag.git-8eed43a.zip
26.47 KB
1 download
filedropkalasag.git-83beb57.tar.bz2
21.32 KB
2 downloads
filedropkalasag.git-83beb57.zip
26.49 KB
1 download
filedropkalasag.git-89d9746.tar.bz2
21.25 KB
2 downloads
filedropkalasag.git-89d9746.zip
26.41 KB
1 download
filedropkalasag.git-a1e8b2b.tar.bz2
21.14 KB
2 downloads
filedropkalasag.git-a1e8b2b.zip
26.30 KB
1 download
filedropkalasag.git-8c3a288.tar.bz2
21.20 KB
2 downloads
filedropkalasag.git-8c3a288.zip
26.46 KB
1 download
filedropkalasag.git-1c9f013.tar.bz2
20.95 KB
131 downloads
filedropkalasag.git-1c9f013.zip
25.81 KB
76 downloads
filedropkalasag.git-3ca3612.tar.bz2
20.80 KB
34 downloads
filedropkalasag.git-3ca3612.zip
25.66 KB
19 downloads
filedropkalasag.git-2ffeaa6.tar.bz2
20.80 KB
36 downloads
filedropkalasag.git-2ffeaa6.zip
25.65 KB
90 downloads
filedropkalasag.git-2834a11.tar.bz2
20.84 KB
139 downloads
filedropkalasag.git-2834a11.zip
25.72 KB
18 downloads
filedropkalasag.git-afd7b31.tar.bz2
20.84 KB
119 downloads
filedropkalasag.git-afd7b31.zip
25.71 KB
98 downloads
filedropkalasag.git-97c89e1.tar.bz2
20.82 KB
116 downloads
filedropkalasag.git-97c89e1.zip
25.68 KB
96 downloads
filedropkalasag.git-1141d13.tar.bz2
20.65 KB
122 downloads
filedropkalasag.git-1141d13.zip
25.37 KB
82 downloads
filedropkalasag.git-ee3c17b.tar.bz2
20.65 KB
113 downloads
filedropkalasag.git-ee3c17b.zip
25.34 KB
24 downloads
filedropkalasag.git-4032c54.tar.bz2
20.63 KB
32 downloads
filedropkalasag.git-4032c54.zip
25.13 KB
87 downloads
filedropkalasag.git-e51a2a6.tar.bz2
20.65 KB
108 downloads
filedropkalasag.git-e51a2a6.zip
25.13 KB
19 downloads
filedropkalasag.git-599c93a.tar.bz2
20.63 KB
104 downloads
filedropkalasag.git-599c93a.zip
25.11 KB
1,612 downloads
filedropkalasag.git-acdc640.tar.bz2
20.63 KB
105 downloads
filedropkalasag.git-acdc640.zip
25.10 KB
14 downloads