1# To make GKrellM for different systems, you can simply:
2# For Linux:
3#	make
4# For FreeBSD 2.X:
5#	make freebsd2
6# For FreeBSD 3.X and 4.X:
7#	make freebsd3
8# For FreeBSD 5.X or later:
9#	make freebsd
10# For NetBSD 1.5 - 1.6.X
11#	make netbsd1
12# For NetBSD 2.X
13#	make netbsd2
14# For OpenBSD
15#	make openbsd
16# For Darwin < 9.0 / Mac OS X < 10.4
17# 	make darwin
18# For newer Darwin systems
19# 	make darwin9
20# For Mac OS X with Quartz-based Gtk+ (experimental)
21# 	make macosx
22# For Solaris 2.x (8 tested so far):
23#	make solaris
24# For libgtop if you have version 1.1.x installed:
25#	make gtop
26# For libgtop if you have version 1.0.x installed in /usr/include & /usr/lib,
27# uncomment GTOP lines below:
28#	make gtop1.0
29# or, eg. if libgtop 1.0 is installed in /opt/gnome/include & /opt/gnome/lib
30#	make gtop1.0 GTOP_PREFIX=/opt/gnome
31#
32# Then:
33#	make install
34# To override default install locations /usr/local/bin and /usr/local/include
35# to, for example, /usr/bin and /usr/include:
36#    make install INSTALLDIR=/usr/bin INCLUDEDIR=/usr/include
37#
38# ------------------------------------------------------------------
39#  If you want to override the default behaviour for the above simple "make"
40#  steps, then uncomment and edit the appropriate lines below.
41#
42# Default
43#--------
44BINMODE = 755
45
46# FreeBSD 2.X
47#------------
48#SYS_LIBS = -lkvm
49#EXTRAOBJS =
50#BINMODE = 4111
51
52
53# FreeBSD 3.X or later
54#---------------------
55#SYS_LIBS = -lkvm -ldevstat
56#EXTRAOBJS =
57#BINMODE = 4111
58
59# NetBSD 1.5 - 1.6.X
60#------------------
61#SYS_LIBS=-lkvm
62#EXTRAOBJS =
63#MANDIR = $(INSTALLROOT)/man/man1
64
65# NetBSD
66#------------------
67#SYS_LIBS=-lkvm -lpthread
68#EXTRAOBJS =
69#MANDIR = $(INSTALLROOT)/man/man1
70
71# OpenBSD
72#------------------
73#SYS_LIBS=-lkvm -lpthread
74#EXTRAOBJS =
75#BINMODE=2755
76
77# Solaris 2.x
78#------------
79#SYS_LIBS = -lkstat -lkvm -ldevinfo
80#EXTRAOBJS = md5c.o
81#BINMODE=2755
82#LOCALEDIR = /usr/local/share/locale
83
84# "make gtop1.0" defaults.  If you don't have gnome or libgtop 1.1.x
85# installed, uncomment and edit these if necessary for a libgtop install.
86# Or, see below about specifying them on the command line.  These are not
87# used if you "make gnome-gtop" or "make gtop".
88#-----------------------------------
89#GTOP_PREFIX = /usr
90#GTOP_INCLUDE = -I$(GTOP_PREFIX)/include
91#GTOP_LIBS = -L$(GTOP_PREFIX)/lib -lgtop -lgtop_common -lgtop_sysdeps -lXau
92#GTOP_LIBS_D = -L$(GTOP_PREFIX)/lib -lgtop -lgtop_common -lgtop_sysdeps
93#export GTOP_INCLUDE GTOP_LIBS GTOP_LIBS_D
94
95VERSION = 2.3.11
96
97INSTALLROOT ?= $(DESTDIR)$(PREFIX)
98
99ifeq ($(INSTALLROOT),)
100	INSTALLROOT = /usr/local
101endif
102
103INSTALLDIR = $(INSTALLROOT)/bin
104SINSTALLDIR ?= $(INSTALLDIR)
105MANDIR ?= $(INSTALLROOT)/share/man/man1
106SMANDIR ?= $(MANDIR)
107MANMODE = 644
108MANDIRMODE = 755
109INCLUDEDIR = $(INSTALLROOT)/include
110INCLUDEMODE = 644
111INCLUDEDIRMODE = 755
112INSTALL ?= $(shell which install)
113PKGCONFIGDIR ?= $(INSTALLROOT)/lib/pkgconfig
114LOCALEDIR ?= $(INSTALLROOT)/share/locale
115
116OS_RELEASE=$(shell uname -r)
117
118export SYS_LIBS EXTRAOBJS BINMODE
119export INSTALLDIR SINSTALLDIR INCLUDEDIR INCLUDEMODE INCLUDEDIRMODE LOCALEDIR
120export MANDIR SMANDIR MANDIRMODE MANMODE
121export OS_RELEASE
122
123enable_nls?=1
124debug=0
125export enable_nls
126export debug
127
128GKRELLM_PC_EXTRA=
129
130all gkrellm: gkrellm.pc
131	(cd po && ${MAKE} all)
132	(cd src && ${MAKE} gkrellm)
133	(cd server && ${MAKE} gkrellmd)
134
135gkrellm.pc: Makefile
136	echo 'prefix=$(INSTALLROOT)' > gkrellm.pc
137	echo 'Name: GKrellM' >> gkrellm.pc
138	echo 'Description: Extensible GTK system monitoring application' >> gkrellm.pc
139	echo 'Version: $(VERSION)' >> gkrellm.pc
140	echo 'Requires: gtk+-2.0 >= 2.4.0' >> gkrellm.pc
141	echo 'Cflags: -I$(INCLUDEDIR)' >> gkrellm.pc
142	echo '$(GKRELLM_PC_EXTRA)' >> gkrellm.pc
143
144install: install_gkrellm.pc
145	(cd po && ${MAKE} install)
146	(cd src && ${MAKE} install)
147	(cd server && ${MAKE} install)
148
149uninstall:
150	(cd po && ${MAKE} uninstall)
151	(cd src && ${MAKE} uninstall)
152	(cd server && ${MAKE} uninstall)
153	rm -f $(PKGCONFIGDIR)/gkrellm.pc
154
155install_gkrellm.pc: gkrellm.pc
156	$(INSTALL) -d $(DESTDIR)$(PKGCONFIGDIR)
157	$(INSTALL) -m $(INCLUDEMODE) -c gkrellm.pc $(DESTDIR)$(PKGCONFIGDIR)
158
159install_darwin install_darwin9 install_macosx: install_gkrellm.pc
160	(cd po && ${MAKE} install)
161	(cd src && ${MAKE} install STRIP="")
162	(cd server && ${MAKE} install STRIP="")
163
164install_freebsd: install_gkrellm.pc
165	(cd po && ${MAKE} install)
166	(cd src && ${MAKE} install_freebsd)
167	(cd server && ${MAKE} install_freebsd)
168
169install_netbsd: install_gkrellm.pc
170	(cd po && ${MAKE} install)
171	(cd src && ${MAKE} install_netbsd)
172	(cd server && ${MAKE} install_netbsd)
173
174install_openbsd: install_gkrellm.pc
175	(cd po && ${MAKE} install)
176	(cd src && ${MAKE} install_openbsd)
177	(cd server && ${MAKE} install_openbsd)
178
179install_solaris: install_gkrellm.pc
180	(cd po && ${MAKE} install)
181	(cd src && ${MAKE} install_solaris)
182	(cd server && ${MAKE} install_solaris)
183
184install_windows: windows install_gkrellm.pc
185	(cd po && ${MAKE} install)
186	(cd src && ${MAKE} install_windows)
187	(cd server && ${MAKE} install_windows)
188
189clean:
190	(cd po && ${MAKE} clean)
191	(cd src && ${MAKE} clean)
192	(cd server && ${MAKE} clean)
193	rm -f gkrellm.pc
194
195freebsd2:	gkrellm.pc
196	(cd po && ${MAKE} all)
197	(cd src && ${MAKE} freebsd2)
198	(cd server && ${MAKE} \
199		EXTRAOBJS= SYS_LIBS="-lkvm " gkrellmd )
200
201freebsd3 freebsd4 freebsd5 freebsd: gkrellm.pc
202	(cd po && ${MAKE} all)
203	(cd src && ${MAKE} freebsd)
204	(cd server && ${MAKE} \
205		EXTRAOBJS= SYS_LIBS="-lkvm -ldevstat " gkrellmd )
206
207darwin: gkrellm.pc
208	(cd po && ${MAKE} all)
209	(cd src && ${MAKE} darwin)
210	(cd server && ${MAKE} darwin)
211
212darwin9: gkrellm.pc
213	(cd po && ${MAKE} all)
214	(cd src && ${MAKE} darwin9)
215	(cd server && ${MAKE} darwin9)
216
217macosx: gkrellm.pc
218	(cd po && ${MAKE} all)
219	(cd src && ${MAKE} macosx)
220	(cd server && ${MAKE} macosx)
221
222netbsd1: gkrellm.pc
223	(cd po && ${MAKE} all)
224	(cd src && ${MAKE} netbsd1)
225	(cd server && ${MAKE} \
226		EXTRAOBJS= SYS_LIBS="-lkvm" gkrellmd )
227
228netbsd2: gkrellm.pc
229	(cd po && ${MAKE} all)
230	(cd src && ${MAKE} netbsd2)
231	(cd server && ${MAKE} \
232		EXTRAOBJS= SYS_LIBS="-lkvm -pthread" gkrellmd )
233
234openbsd: gkrellm.pc
235	(cd po && ${MAKE} all)
236	(cd src && ${MAKE} \
237		PTHREAD_INC=-I${PREFIX}/include EXTRAOBJS= \
238		SYS_LIBS="-lkvm -pthread" gkrellm )
239	(cd server && ${MAKE} \
240		PTHREAD_INC=-I${PREFIX}/include EXTRAOBJS= \
241		SYS_LIBS="-lkvm -pthread" gkrellmd )
242
243solaris: gkrellm.pc
244	(cd po && ${MAKE} MSGFMT_OPT="-v -o" \
245		LOCALEDIR=/usr/local/share/locale all)
246ifeq ($(OS_RELEASE),5.8)
247	(cd src && ${MAKE} CC=gcc \
248		CFLAGS="-Wno-implicit-int" \
249		SYS_LIBS="-lkstat -lkvm -ldevinfo -lresolv -lsocket -lX11 -lintl" \
250		LINK_FLAGS="" gkrellm )
251	(cd server && ${MAKE} CC=gcc \
252		CFLAGS="-Wno-implicit-int -DSOLARIS_8" \
253		SYS_LIBS="-lkstat -lkvm -ldevinfo -lsocket -lnsl -lintl" \
254		LINK_FLAGS="" gkrellmd )
255else
256	(cd src && ${MAKE} CC=gcc \
257		CFLAGS="-Wno-implicit-int" \
258		SYS_LIBS="-lkstat -lkvm -ldevinfo -lresolv -lsocket -lX11" LINK_FLAGS="" gkrellm )
259	(cd server && ${MAKE} CC=gcc \
260		CFLAGS="-Wno-implicit-int" \
261		SYS_LIBS="-lkstat -lkvm -ldevinfo -lsocket -lnsl" LINK_FLAGS="" gkrellmd )
262endif
263
264gnome-gtop: gkrellm.pc
265	(cd po && ${MAKE} all)
266	(cd src && ${MAKE} GTOP_PREFIX="\`gnome-config --prefix libgtop\`" \
267		GTOP_INCLUDE="\`gnome-config --cflags libgtop\`" \
268		GTOP_LIBS="\`gnome-config --libs libgtop\`" \
269		SYS_LIBS= gkrellm )
270	(cd server && ${MAKE} GTOP_PREFIX="\`gnome-config --prefix libgtop\`" \
271		GTOP_INCLUDE="\`gnome-config --cflags libgtop\`" \
272		GTOP_LIBS_D="\`gnome-config --libs libgtop\`" \
273		SYS_LIBS= gkrellmd )
274
275gtop: gkrellm.pc
276	(cd po && ${MAKE} all)
277	(cd src && ${MAKE} GTOP_INCLUDE="\`libgtop-config --cflags\`" \
278		GTOP_LIBS="\`libgtop-config --libs\`" \
279		SYS_LIBS="-lXau" gkrellm )
280	(cd server && ${MAKE} GTOP_INCLUDE="\`libgtop-config --cflags\`" \
281		GTOP_LIBS_D="\`libgtop-config --libs\`" \
282		SYS_LIBS= gkrellmd )
283
284gtop1.0: gkrellm.pc
285	(cd po && ${MAKE} all)
286	(cd src && ${MAKE} gkrellm )
287	(cd server && ${MAKE} gkrellmd )
288
289windows: GKRELLM_PC_EXTRA:=Libs: -L$${prefix}/lib -Wl,-Bstatic,-lgkrellm,-Bdynamic
290windows: gkrellm.pc
291	(cd po && ${MAKE} LOCALEDIR="share/locale" all)
292	(cd src && ${MAKE} LOCALEDIR="share/locale" windows )
293	(cd server && ${MAKE} LOCALEDIR="share/locale" windows)
294
295msgmerge:
296	(cd po && ${MAKE} messages)
297	(cd po && ${MAKE} merge)
298