|
| 1 | +# houseclock - A simple GPS Time Server with Web console |
| 2 | +# |
| 3 | +# Copyright 2023, Pascal Martin |
| 4 | +# |
| 5 | +# This program is free software; you can redistribute it and/or |
| 6 | +# modify it under the terms of the GNU General Public License |
| 7 | +# as published by the Free Software Foundation; either version 2 |
| 8 | +# of the License, or (at your option) any later version. |
| 9 | +# |
| 10 | +# This program is distributed in the hope that it will be useful, |
| 11 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | +# GNU General Public License for more details. |
| 14 | +# |
| 15 | +# You should have received a copy of the GNU General Public License |
| 16 | +# along with this program; if not, write to the Free Software |
| 17 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 | +# Boston, MA 02110-1301, USA. |
| 19 | + |
| 20 | +HAPP=houseclock |
| 21 | +HROOT=/usr/local |
| 22 | +SHARE=$(HROOT)/share/house |
| 23 | + |
| 24 | +# Application build. -------------------------------------------- |
1 | 25 |
|
2 | 26 | OBJS= hc_db.o hc_http.o hc_clock.o hc_tty.o hc_nmea.o hc_broadcast.o hc_ntp.o houseclock.o
|
3 | 27 |
|
4 |
| -SHARE=/usr/local/share/house |
5 |
| - |
6 | 28 | all: houseclock
|
7 | 29 |
|
8 | 30 | broadcast: hc_broadcast.o
|
@@ -34,69 +56,26 @@ package:
|
34 | 56 |
|
35 | 57 | # Distribution agnostic file installation -----------------------
|
36 | 58 |
|
37 |
| -install-files: |
38 |
| - mkdir -p /usr/local/bin |
39 |
| - rm -f /usr/local/bin/houseclock |
40 |
| - cp houseclock /usr/local/bin |
41 |
| - chown root:root /usr/local/bin/houseclock |
42 |
| - chmod 755 /usr/local/bin/houseclock |
| 59 | +install-app: |
| 60 | + mkdir -p $(HROOT)/bin |
| 61 | + rm -f $(HROOT)/bin/houseclock |
| 62 | + cp houseclock $(HROOT)/bin |
| 63 | + chown root:root $(HROOT)/bin/houseclock |
| 64 | + chmod 755 $(HROOT)/bin/houseclock |
43 | 65 | mkdir -p $(SHARE)/public/ntp
|
44 | 66 | cp public/* $(SHARE)/public/ntp
|
45 | 67 | chmod 644 $(SHARE)/public/ntp/*
|
46 | 68 | chmod 755 $(SHARE) $(SHARE)/public $(SHARE)/public/ntp
|
47 | 69 |
|
48 |
| -uninstall-files: |
| 70 | +uninstall-app: |
49 | 71 | rm -rf $(SHARE)/public/ntp
|
50 |
| - rm -f /usr/local/bin/houseclock |
51 |
| - |
52 |
| -purge-config: |
53 |
| - |
54 |
| -# Distribution agnostic systemd support ------------------------- |
55 |
| - |
56 |
| -install-systemd: |
57 |
| - if [ -e /lib/systemd/system/systemd-timesyncd.service ] ; then systemctl stop systemd-timesyncd ; systemctl disable systemd-timesyncd ; fi |
58 |
| - if [ -e /etc/init.d/ntp ] ; then systemctl stop ntp ; systemctl disable ntp ; fi |
59 |
| - if [ -e /lib/systemd/system/ntp.service ] ; then systemctl stop ntp ; systemctl disable ntp ; fi |
60 |
| - if [ -e /etc/init.d/chrony ] ; then systemctl stop chrony ; systemctl disable chrony ; fi |
61 |
| - if [ -e /lib/systemd/system/chrony.service ] ; then systemctl stop chrony ; systemctl disable chrony ; fi |
62 |
| - cp systemd.service /lib/systemd/system/houseclock.service |
63 |
| - chown root:root /lib/systemd/system/houseclock.service |
64 |
| - systemctl daemon-reload |
65 |
| - systemctl enable houseclock |
66 |
| - systemctl start houseclock |
67 |
| - |
68 |
| -uninstall-systemd: stop-systemd |
69 |
| - if [ -e /lib/systemd/system/systemd-timesyncd.service ] ; then systemctl enable systemd-timesyncd ; systemctl start systemd-timesyncd ; fi |
70 |
| - if [ -e /etc/init.d/ntp ] ; then systemctl enable ntp ; systemctl start ntp ; fi |
71 |
| - if [ -e /lib/systemd/system/ntp.service ] ; then systemctl enable ntp ; systemctl start ntp ; fi |
72 |
| - if [ -e /etc/init.d/chrony ] ; then systemctl enable chrony ; systemctl start chrony ; fi |
73 |
| - if [ -e /lib/systemd/system/chrony.service ] ; then systemctl start chrony ; systemctl start chrony ; fi |
74 |
| - |
75 |
| -stop-systemd: |
76 |
| - if [ -e /etc/init.d/houseclock ] ; then systemctl stop houseclock ; systemctl disable houseclock ; rm -f /etc/init.d/houseclock ; fi |
77 |
| - if [ -e /lib/systemd/system/houseclock.service ] ; then systemctl stop houseclock ; systemctl disable houseclock ; rm -f /lib/systemd/system/houseclock.service ; fi |
78 |
| - |
79 |
| -# Debian GNU/Linux install -------------------------------------- |
| 72 | + rm -f $(HROOT)/bin/houseclock |
80 | 73 |
|
81 |
| -install-debian: stop-systemd install-files install-systemd |
| 74 | +purge-app: |
82 | 75 |
|
83 |
| -uninstall-debian: uninstall-systemd uninstall-files |
84 |
| - |
85 |
| -purge-debian: uninstall-debian purge-config |
86 |
| - |
87 |
| -# Void Linux install -------------------------------------------- |
88 |
| - |
89 |
| -install-void: install-files |
90 |
| - |
91 |
| -uninstall-void: uninstall-files |
92 |
| - |
93 |
| -purge-void: uninstall-void purge-config |
94 |
| - |
95 |
| -# Default install (Debian GNU/Linux) ---------------------------- |
96 |
| - |
97 |
| -install: install-debian |
| 76 | +purge-config: |
98 | 77 |
|
99 |
| -uninstall: uninstall-debian |
| 78 | +# System installation. ------------------------------------------ |
100 | 79 |
|
101 |
| -purge: purge-debian |
| 80 | +include $(SHARE)/install.mak |
102 | 81 |
|
0 commit comments