File: Makefile

package info (click to toggle)
gkrelltop 2.2.13-1.3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 308 kB
  • sloc: sh: 2,805; ansic: 1,823; makefile: 168
file content (144 lines) | stat: -rw-r--r-- 3,900 bytes parent folder | download
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Makefile for gkrelltop 
#
# tries to autodetect for gtk+-2.0 to compile for
# gkrellm 2 or if it is lacking it tries to compile
# for gkrellm 1. 
# If it fails to build, then maybe you dont have the 
# gtk+-2.0 or gtk+-1.2 development tools (which you need 
# to have installed) to compile this package.
#
# for linux need the -DLINUX as a CFLAGS parameter

# to compile for FREEBSD the CFLAGS parameter 
# needs to be -DFREEBSD 
# and as David Gardner pointed out, FreeBSD users need to use 
# the GNU make utility (gmake) instead of the BSD make 
# utility (make) in order for it to compile.
# 
# I have attempted to detect the os by the OSFLAG variable 
# NOTE that it will work only for LINUX or FREEBSD 
# 
# if you think it should work for your os than substituting
# your $(OSFLAG) will not quite do the trick because the wmtop code 
# (the three_top.c file) only recognises those two (LINUX and FREEBSD)
# parameters. Let me know if the more recent versions of wmtop 
# support more OS.


OSFLAG = $(shell uname | tr '[:lower:]' '[:upper:]')
SHELL=/bin/sh

PKG_CONFIG ?= pkg-config
GKRELL1FLAG=1
#find out if we have gkrellm 2 or 1 (from the gtk+ version)
GKRELL1FLAG=$(shell bash -c '$(PKG_CONFIG) gtk+-2.0 --cflags &>/dev/null && echo 0')
GKRELLTOP = gkrelltop.so
OBJ = top_three.o gkrelltop.o 
EXTRA = krell_panel1.xpm

INSTALLDIR ?= $(PREFIX)/$(DESTDIR)
ifeq ($(INSTALLDIR),)
	INSTALLDIR=/usr/lib/gkrellm2/plugins/
endif


ifeq ($(GKRELL1FLAG),0)
# Parameters for gkrellm version 2.*
CFLAGS += -g -D$(OSFLAG) -DGKRELLM2 -fPIC -Wall `$(PKG_CONFIG) gtk+-2.0 --cflags`
LIBS = `$(PKG_CONFIG) gtk+-2.0 --libs`
else 
# Parameters for gkrellm version 1.*
CFLAGS = -D$(OSFLAG) -Wall -fPIC `gtk-config --cflags` `imlib-config --cflags-gdk`
LIBS=
endif


# Parameters for the gkrelltopd server plugin
ifeq ($(glib12),yes)
WANT_GLIB12 = yes
endif
ifeq ($(glib12),1)
WANT_GLIB12 = yes
endif

ifeq ($(WANT_GLIB12),yes)
CFLAGSD = -I/usr/X11R6/include -D$(OSFLAG) -fPIC -Wall `glib-config --cflags`
LIBSD = `glib-config --libs`
LIBSD = 
CONFIGURE_ARGS += --with-glib12
else
CFLAGSD = -D$(OSFLAG) -fPIC -Wall `$(PKG_CONFIG) glib-2.0 --cflags`
LIBSD = `$(PKG_CONFIG) glib-2.0 --libs`
LIBSD = 
endif
INSTALLDIRD ?= $(PREFIXD)/$(DESTDIR)
ifeq ($(INSTALLDIRD),)
	INSTALLDIRD=$(HOME)/.gkrellm2/plugins-gkrellmd
endif
OBJD = gkrelltopd.o top_three.o

DUMMY_VAR := $(shell ./configure $(CONFIGURE_ARGS))
HAVE_GKRELLMD = $(shell grep -c HAVE_GKRELLMD configure.h)

ifneq ($(HAVE_GKRELLMD),1)
WARN = $(warning Note: cannot compile server plugin.  See configure.log.)
endif


ifeq ($(HAVE_GKRELLMD),1)
	GKRELLTOPD = gkrelltopd.so
endif

# By default do the compilation for gkrellm 2.*
all: $(GKRELLTOP) $(GKRELLTOPD)


warn: ; $(WARN)

$(GKRELLTOP): $(OBJ) warn
	$(CC) $(CFLAGS) -shared $(OBJ) $(LIBS) -o $(GKRELLTOP) 

# Compile gkrelltopd.so server plugin
server: $(GKRELLTOPD) warn
	@echo ""

$(GKRELLTOPD): $(OBJD) 
	$(CC) $(CFLAGSD) $(LIBSD) -shared $(OBJD) -o $(GKRELLTOPD)

gkrelltop.o: gkrelltop.c
	$(CC) $(CFLAGS) -c gkrelltop.c -o gkrelltop.o

top_three.o: top_three.c
	$(CC) $(CFLAGS) -c top_three.c -o top_three.o

gkrelltopd.o: gkrelltopd.c
	$(CC) $(CFLAGSD) -c gkrelltopd.c -o gkrelltopd.o

install: $(GKRELLTOP)
	install -c -m 644 $(GKRELLTOP) $(INSTALLDIR)

install-server: $(GKRELLTOPD)
	install -c -m 644 $(GKRELLTOPD) $(INSTALLDIRD)

ttest: top_three.o ttest.o 
	$(CC) $(CFLAGS) top_three.o ttest.o -o ttest

view: $(GKRELLTOP)
	gkrellm -p $(GKRELLTOP)

deb:
	fakeroot debian/rules binary

orig:
	echo `pwd` | grep 'orig' || (mkdir `pwd`.orig; cp -p Makefile README config.guess config.sub configure gkrelltop.c gkrelltop.h gkrelltopd.c krell_image.xpm support.h ttest.c top_three.c `pwd`.orig/ )

package: orig
	#old:
	#@dpkg-buildpackage -rfakeroot -uc -us
	#debsign ../gkrelltop*.changes
	debuild -b && debuild -S

clean: 
	@rm -f *.o *.so configure.h configure.log ttest

distclean: clean