Debian Codegraph @

Makefile

raw symbols ◀ ▶
Source reconstructed at patch state 1 of 8 — not the installed (fully patched) source.
8 Debian patches touch this file
1 # Makefile for System & Process Monitor ATOP (Linux version)
2 #
3 # Gerlof Langeveld - [email protected]
4 #
5 DESTDIR =
6
7 BINPATH = /usr/bin
8 SBINPATH = /usr/sbin
9 SCRPATH = /usr/share/atop
10 LOGPATH = /var/log/atop
11 MAN1PATH = /usr/share/man/man1
12 MAN5PATH = /usr/share/man/man5
13 MAN8PATH = /usr/share/man/man8
14 INIPATH = /etc/init.d
15 DEFPATH = /etc/default
16 SYSDPATH = /lib/systemd/system
17 CRNPATH = /etc/cron.d
18 ROTPATH = /etc/logrotate.d
19 PMPATH1 = /usr/lib/pm-utils/sleep.d
20 PMPATH2 = /usr/lib64/pm-utils/sleep.d
21 PMPATHD = /usr/lib/systemd/system-sleep
22
23 PKG_CONFIG ?= pkg-config
24
25 override CFLAGS := -O2 -I. -Wall $(shell $(PKG_CONFIG) --cflags glib-2.0) -Wmissing-prototypes -Wmissing-declarations -Wformat-security $(CFLAGS) # -DNOPERFEVENT # -DHTTPSTATS
26
27 CC_CHECK := $(shell echo | $(CC) -dM -E - | grep -q __clang__ && echo clang || echo gcc)
28 ifeq ($(CC_CHECK),gcc)
29 override CFLAGS += -Wno-stringop-truncation
30 endif
31
32 override LDFLAGS := $(shell $(PKG_CONFIG) --libs glib-2.0) $(LDFLAGS)
33
34 OBJMOD0 = version.o
35 OBJMOD1 = various.o deviate.o procdbase.o
36 OBJMOD2 = acctproc.o photoproc.o photosyst.o cgroups.o rawlog.o ifprop.o parseable.o
37 OBJMOD3 = showgeneric.o drawbar.o showlinux.o showsys.o showprocs.o
38 OBJMOD4 = atopsar.o netatopif.o netatopbpfif.o gpucom.o json.o utsnames.o
39 ALLMODS = $(OBJMOD0) $(OBJMOD1) $(OBJMOD2) $(OBJMOD3) $(OBJMOD4)
40
41 VERS = $(shell ./atop -V 2>/dev/null| sed -e 's/^[^ ]* //' -e 's/ .*//')
42
43 all: atop atopsar atopacctd atopconvert atopcat atophide
44
45 atop: atop.o $(ALLMODS) Makefile
46 $(CC) atop.o $(ALLMODS) -o atop -lncursesw -lz -lm -lrt $(LDFLAGS)
47
48 atopsar: atop
49 ln -sf atop atopsar
50
51 atopacctd: atopacctd.o netlink.o
52 $(CC) atopacctd.o netlink.o -o atopacctd $(LDFLAGS)
53
54 atopconvert: atopconvert.o
55 $(CC) atopconvert.o -o atopconvert -lz $(LDFLAGS)
56
57 atopcat: atopcat.o
58 $(CC) atopcat.o -o atopcat $(LDFLAGS)
59
60 atophide: atophide.o
61 $(CC) atophide.o -o atophide -lz $(LDFLAGS)
62
63 clean:
64 rm -f *.o atop atopsar atopacctd atopconvert atopcat atophide
65
66 distr:
67 rm -f *.o atop
68 tar czvf /tmp/atop.tar.gz *
69
70 # default install is based on systemd
71 #
72 install: genericinstall
73 if [ ! -d $(DESTDIR)$(SYSDPATH) ]; \
74 then mkdir -p $(DESTDIR)$(SYSDPATH); fi
75 if [ ! -d $(DESTDIR)$(PMPATHD) ]; \
76 then mkdir -p $(DESTDIR)$(PMPATHD); fi
77 #
78 cp atop.service $(DESTDIR)$(SYSDPATH)
79 chmod 0644 $(DESTDIR)$(SYSDPATH)/atop.service
80 cp atopgpu.service $(DESTDIR)$(SYSDPATH)
81 chmod 0644 $(DESTDIR)$(SYSDPATH)/atopgpu.service
82 cp atop-rotate.service $(DESTDIR)$(SYSDPATH)
83 chmod 0644 $(DESTDIR)$(SYSDPATH)/atop-rotate.service
84 cp atop-rotate.timer $(DESTDIR)$(SYSDPATH)
85 chmod 0644 $(DESTDIR)$(SYSDPATH)/atop-rotate.timer
86 cp atopacct.service $(DESTDIR)$(SYSDPATH)
87 chmod 0644 $(DESTDIR)$(SYSDPATH)/atopacct.service
88 cp atop-pm.sh $(DESTDIR)$(PMPATHD)
89 chmod 0711 $(DESTDIR)$(PMPATHD)/atop-pm.sh
90 #
91 # only when making on target system:
92 #
93 if [ -z "$(DESTDIR)" -a -f /bin/systemctl ]; \
94 then /bin/systemctl disable --now atop 2> /dev/null; \
95 /bin/systemctl disable --now atopacct 2> /dev/null; \
96 /bin/systemctl daemon-reload; \
97 /bin/systemctl enable --now atopacct; \
98 /bin/systemctl enable --now atop; \
99 /bin/systemctl enable --now atop-rotate.timer; \
100 fi
101
102
103 # explicitly use sysvinstall for System V init based systems
104 #
105 sysvinstall: genericinstall
106 if [ ! -d $(DESTDIR)$(INIPATH) ]; \
107 then mkdir -p $(DESTDIR)$(INIPATH); fi
108 if [ ! -d $(DESTDIR)$(SCRPATH) ]; \
109 then mkdir -p $(DESTDIR)$(SCRPATH); fi
110 if [ ! -d $(DESTDIR)$(CRNPATH) ]; \
111 then mkdir -p $(DESTDIR)$(CRNPATH); fi
112 if [ ! -d $(DESTDIR)$(ROTPATH) ]; \
113 then mkdir -p $(DESTDIR)$(ROTPATH); fi
114 #
115 cp atop.init $(DESTDIR)$(INIPATH)/atop
116 cp atopacct.init $(DESTDIR)$(INIPATH)/atopacct
117 cp atop.cronsysv $(DESTDIR)$(CRNPATH)/atop
118 cp atop.daily $(DESTDIR)$(SCRPATH)
119 chmod 0711 $(DESTDIR)$(SCRPATH)/atop.daily
120 touch $(DESTDIR)$(LOGPATH)/dummy_before
121 touch $(DESTDIR)$(LOGPATH)/dummy_after
122 #
123 if [ -d $(DESTDIR)$(PMPATH1) ]; \
124 then cp 45atoppm $(DESTDIR)$(PMPATH1); \
125 chmod 0711 $(DESTDIR)$(PMPATH1)/45atoppm; \
126 fi
127 if [ -d $(DESTDIR)$(PMPATH2) ]; \
128 then cp 45atoppm $(DESTDIR)$(PMPATH2); \
129 chmod 0711 $(DESTDIR)$(PMPATH2)/45atoppm; \
130 fi
131 #
132 #
133 # only when making on target system:
134 #
135 if [ -z "$(DESTDIR)" -a -f /sbin/chkconfig ]; \
136 then /sbin/chkconfig --del atop 2> /dev/null; \
137 /sbin/chkconfig --add atop; \
138 /sbin/chkconfig --del atopacct 2> /dev/null; \
139 /sbin/chkconfig --add atopacct; \
140 fi
141 if [ -z "$(DESTDIR)" -a -f /usr/sbin/update-rc.d ]; \
142 then update-rc.d atop defaults; \
143 update-rc.d atopacct defaults; \
144 fi
145 if [ -z "$(DESTDIR)" -a -f /sbin/service ]; \
146 then /sbin/service atopacct start; \
147 sleep 2; \
148 /sbin/service atop start; \
149 fi
150
151
152 genericinstall: atop atopacctd atopconvert atopcat atophide
153 if [ ! -d $(DESTDIR)$(LOGPATH) ]; \
154 then mkdir -p $(DESTDIR)$(LOGPATH); fi
155 if [ ! -d $(DESTDIR)$(DEFPATH) ]; \
156 then mkdir -p $(DESTDIR)$(DEFPATH); fi
157 if [ ! -d $(DESTDIR)$(BINPATH) ]; \
158 then mkdir -p $(DESTDIR)$(BINPATH); fi
159 if [ ! -d $(DESTDIR)$(SBINPATH) ]; \
160 then mkdir -p $(DESTDIR)$(SBINPATH); fi
161 if [ ! -d $(DESTDIR)$(MAN1PATH) ]; \
162 then mkdir -p $(DESTDIR)$(MAN1PATH); fi
163 if [ ! -d $(DESTDIR)$(MAN5PATH) ]; \
164 then mkdir -p $(DESTDIR)$(MAN5PATH); fi
165 if [ ! -d $(DESTDIR)$(MAN8PATH) ]; \
166 then mkdir -p $(DESTDIR)$(MAN8PATH); fi
167 #
168 touch $(DESTDIR)$(DEFPATH)/atop
169 chmod 644 $(DESTDIR)$(DEFPATH)/atop
170 #
171 cp atop $(DESTDIR)$(BINPATH)/atop
172 chmod 0711 $(DESTDIR)$(BINPATH)/atop
173 ln -sf atop $(DESTDIR)$(BINPATH)/atopsar
174 cp atopacctd $(DESTDIR)$(SBINPATH)/atopacctd
175 chmod 0700 $(DESTDIR)$(SBINPATH)/atopacctd
176 cp atopgpud $(DESTDIR)$(SBINPATH)/atopgpud
177 chmod 0700 $(DESTDIR)$(SBINPATH)/atopgpud
178 cp atop $(DESTDIR)$(BINPATH)/atop-$(VERS)
179 ln -sf atop-$(VERS) $(DESTDIR)$(BINPATH)/atopsar-$(VERS)
180 cp atopconvert $(DESTDIR)$(BINPATH)/atopconvert
181 chmod 0711 $(DESTDIR)$(BINPATH)/atopconvert
182 cp atopcat $(DESTDIR)$(BINPATH)/atopcat
183 chmod 0711 $(DESTDIR)$(BINPATH)/atopcat
184 cp atophide $(DESTDIR)$(BINPATH)/atophide
185 chmod 0711 $(DESTDIR)$(BINPATH)/atophide
186 cp man/atop.1 $(DESTDIR)$(MAN1PATH)
187 cp man/atopsar.1 $(DESTDIR)$(MAN1PATH)
188 cp man/atopconvert.1 $(DESTDIR)$(MAN1PATH)
189 cp man/atopcat.1 $(DESTDIR)$(MAN1PATH)
190 cp man/atophide.1 $(DESTDIR)$(MAN1PATH)
191 cp man/atoprc.5 $(DESTDIR)$(MAN5PATH)
192 cp man/atopacctd.8 $(DESTDIR)$(MAN8PATH)
193 cp man/atopgpud.8 $(DESTDIR)$(MAN8PATH)
194
195 ##########################################################################
196
197 versdate.h:
198 #./mkdate
199
200 atop.o: atop.h photoproc.h photosyst.h acctproc.h showgeneric.h
201 atopsar.o: atop.h photoproc.h photosyst.h
202 rawlog.o: atop.h photoproc.h photosyst.h rawlog.h showgeneric.h
203 various.o: atop.h acctproc.h
204 ifprop.o: atop.h photosyst.h ifprop.h
205 parseable.o: atop.h photoproc.h photosyst.h cgroups.h parseable.h
206 deviate.o: atop.h photoproc.h photosyst.h
207 procdbase.o: atop.h photoproc.h
208 acctproc.o: atop.h photoproc.h atopacctd.h acctproc.h netatop.h
209 netatopif.o: atop.h photoproc.h netatopd.h netatop.h
210 netatopbpfif.o: atop.h photoproc.h netatop.h
211 photoproc.o: atop.h photoproc.h
212 photosyst.o: atop.h photosyst.h
213 cgroups.o: atop.h cgroups.h
214 showgeneric.o: atop.h photoproc.h photosyst.h cgroups.h showgeneric.h showlinux.h
215 showlinux.o: atop.h photoproc.h photosyst.h cgroups.h showgeneric.h showlinux.h
216 showsys.o: atop.h photoproc.h photosyst.h showgeneric.h
217 showprocs.o: atop.h photoproc.h photosyst.h cgroups.h showgeneric.h showlinux.h
218 drawbar.o: atop.h photosyst.h showgeneric.h
219 version.o: version.c version.h versdate.h
220 gpucom.o: atop.h photoproc.h photosyst.h
221
222 atopacctd.o: atop.h photoproc.h acctproc.h atopacctd.h version.h versdate.h
223
224 atopconvert.o: atop.h photoproc.h photosyst.h rawlog.h
225 atopcat.o: atop.h rawlog.h
226 atophide.o: atop.h photoproc.h photosyst.h rawlog.h