-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
122 lines (93 loc) · 3.52 KB
/
Makefile
File metadata and controls
122 lines (93 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# housesprinkler - A simple home web server for sprinkler control
#
# Copyright 2023, Pascal Martin
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# WARNING
#
# This Makefile depends on echttp and houseportal (dev) being installed.
prefix=/usr/local
SHARE=$(prefix)/share/house
INSTALL=/usr/bin/install
HAPP=housesprinkler
HCAT=automation
EXTRADOC=/var/lib/house/note/extra
# Local build ---------------------------------------------------
OBJS= housesprinkler.o \
housesprinkler_index.o \
housesprinkler_season.o \
housesprinkler_interval.o \
housesprinkler_program.o \
housesprinkler_schedule.o \
housesprinkler_control.o \
housesprinkler_zone.o \
housesprinkler_feed.o \
housesprinkler_time.o \
housesprinkler_state.o
ICONS= favicon_1_16x16x4.png
LIBOJS=
all: housesprinkler
clean:
rm -f *.o *.a housesprinkler
rebuild: clean all
%.o: %.c
gcc -c -Wall -g -Os -o $@ $<
housesprinkler: $(OBJS)
gcc -g -Os -o housesprinkler $(OBJS) -lhouseportal -lechttp -luuid -lssl -lcrypto -lmagic -lrt
# Distribution agnostic file installation -----------------------
dev:
install-ui: install-preamble
$(INSTALL) -m 0755 -d $(DESTDIR)$(SHARE)/public/sprinkler
$(INSTALL) -m 0644 public/* $(DESTDIR)$(SHARE)/public/sprinkler
$(INSTALL) -m 0755 -d $(DESTDIR)$(EXTRADOC)/$(HPKG)/gallery
$(INSTALL) -m 0644 gallery/* $(DESTDIR)$(EXTRADOC)/$(HPKG)/gallery
install-runtime: install-preamble
$(INSTALL) -m 0755 -s housesprinkler $(DESTDIR)$(prefix)/bin
touch $(DESTDIR)/etc/default/housesprinkler
install-app: install-ui install-runtime
uninstall-app:
rm -rf $(DESTDIR)$(SHARE)/public/sprinkler
rm -f $(DESTDIR)$(prefix)/bin/housesprinkler
purge-app:
purge-config:
rm -f $(DESTDIR)/etc/house/sprinkler.json
rm -f $(DESTDIR)/etc/default/housesprinkler
# Build a private Debian package. -------------------------------
install-package: install-ui install-runtime install-systemd
debian-package: debian-package-generic
# System installation. ------------------------------------------
include $(SHARE)/install.mak
# Docker install ------------------------------------------------
docker: all
rm -rf build
mkdir -p build$(prefix)/bin
mkdir -p build/var/lib/house
cp housesprinkler build$(prefix)/bin
chmod 755 build$(prefix)/bin/housesprinkler
mkdir -p build/etc/house
touch build/etc/house/sprinkler.json
mkdir -p build$(SHARE)/public/sprinkler
chmod 755 build$(SHARE) build$(SHARE)/public build$(SHARE)/public/sprinkler
cp public/* build$(SHARE)/public/sprinkler
cp $(SHARE)/public/house.css $(SHARE)/public/event.js build$(SHARE)/public
icotool -c -o build$(SHARE)/public/favicon.ico $(ICONS)
chmod 644 build$(SHARE)/public/sprinkler/*
chmod 644 build$(SHARE)/public/house.css build$(SHARE)/public/event.js
chmod 644 build$(SHARE)/public/favicon.ico
cp Dockerfile build
cd build ; docker build -t housesprinkler .
rm -rf build