aboutsummaryrefslogtreecommitdiffstats
path: root/GNUmakefile
blob: 06fa9dce9055551fbdb8d7e0ec05ed61a21e7218 (plain)
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
# config
-include Make.config
include mk/Variables.mk

# add our flags + libs
CFLAGS	+= -DVERSION='"$(VERSION)"' -DLIB='"$(LIB)"'

# valgrind options
VFLAGS	:= --leak-check=full --show-possibly-lost=no 

# build
TARGETS		:= vconsole

# default target
all: build

#################################################################
# poor man's autoconf ;-)

include mk/Autoconf.mk

define make-config
LIB		:= $(LIB)
HAVE_GLIB	:= $(call ac_pkg_config,glib-2.0)
HAVE_GTHREAD	:= $(call ac_pkg_config,gthread-2.0)
HAVE_GTK2	:= $(call ac_pkg_config,gtk+-2.0)
HAVE_VTE2	:= $(call ac_pkg_config,vte)
HAVE_GTK3	:= $(call ac_pkg_config,gtk+-3.0)
HAVE_VTE3	:= $(call ac_pkg_config,vte-2.90)
HAVE_LIBVIRT	:= $(call ac_pkg_config,libvirt)
endef

ifeq ($(HAVE_GTK3)-$(HAVE_VTE3),yes-yes)
CFLAGS += -Wno-deprecated-declarations
wanted := $(HAVE_GLIB)-$(HAVE_GTHREAD)-$(HAVE_GTK3)-$(HAVE_VTE3)-$(HAVE_LIBVIRT)
pkglst := glib-2.0 gthread-2.0 gtk+-3.0 vte-2.90 libvirt
else
wanted := $(HAVE_GLIB)-$(HAVE_GTHREAD)-$(HAVE_GTK2)-$(HAVE_VTE2)-$(HAVE_LIBVIRT)
pkglst := glib-2.0 gthread-2.0 gtk+-2.0 vte libvirt
endif

CFLAGS += -Wno-strict-prototypes
CFLAGS += $(shell test "$(pkglst)" != "" && pkg-config --cflags $(pkglst))
LDLIBS += $(shell test "$(pkglst)" != "" && pkg-config --libs   $(pkglst))

# desktop files
DESKTOP := $(wildcard $(patsubst %,%.desktop,$(TARGETS)))


########################################################################
# rules

ifeq ($(wanted),yes-yes-yes-yes-yes)
build: $(TARGETS)
else
build:
	@echo "build dependencies are missing"
	@false
endif

install: build
	$(INSTALL_DIR) $(bindir) $(mandir)/man1 $(appdir)
	$(INSTALL_BINARY) $(TARGETS) $(bindir)
	$(INSTALL_DATA) vconsole.man $(mandir)/man1/vconsole.1
	$(INSTALL_DATA) $(DESKTOP) $(appdir)

valgrind: vconsole
	rm -f valgrind.log
	valgrind $(VFLAGS) --log-file=valgrind.log ./vconsole

clean:
	-rm -f *.o *~ $(depfiles)

realclean distclean: clean
	-rm -f Make.config
	-rm -f $(TARGETS) *~ *.bak

#############################################

vconsole: vconsole.o connect.o domain.o libvirt-glib-event.o

include mk/Compile.mk
include mk/Maintainer.mk
-include $(depfiles)