aboutsummaryrefslogtreecommitdiffstats
path: root/GNUmakefile
blob: 57fa683f1dc89c0d16195ec58f2f6c746ee36cc8 (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
85
# config
-include Make.config
include mk/Variables.mk

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

# build
TARGETS		:= xenlog
BUILD_GTK	:= xenwatch mdns-browser
BUILD_MDNS	:= mdns-publish-xendom

NEEDS_XENSTORE	:= xenlog xenwatch mdns-publish-xendom
NEEDS_GTK	:= xenwatch mdns-browser
NEEDS_MDNS	:= xenwatch mdns-browser mdns-publish-xendom

# default target
all: build


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

include mk/Autoconf.mk

define make-config
LIB		:= $(LIB)
HAVE_GTK	:= $(call ac_pkg_config,gtk+-x11-2.0)
HAVE_AVAHI	:= $(call ac_pkg_config,avahi-glib)
endef

# gtk stuff
ifeq ($(HAVE_GTK),yes)
  $(NEEDS_GTK) : CFLAGS += -Wno-strict-prototypes
  $(NEEDS_GTK) : pkglst += gtk+-x11-2.0
  TARGETS += $(BUILD_GTK)
endif

# avahi stuff
ifeq ($(HAVE_AVAHI),yes)
  $(NEEDS_MDNS) : CFLAGS += -DHAVE_AVAHI=1
  $(NEEDS_MDNS) : pkglst += avahi-client
  $(NEEDS_GTK)  : pkglst += avahi-glib
  TARGETS += $(BUILD_MDNS)
endif

# pkg-config flags
CFLAGS += $(shell test "$(pkglst)" != "" && pkg-config --cflags $(pkglst))
LDLIBS += $(shell test "$(pkglst)" != "" && pkg-config --libs   $(pkglst))

# xenstore
ifneq ($(XENSRC),)
  $(NEEDS_XENSTORE) : CFLAGS += -I $(XENSRC)/dist/install/usr/include
  $(NEEDS_XENSTORE) : LDLIBS += -I $(XENSRC)/dist/install/usr/$(LIB)
endif
$(NEEDS_XENSTORE)   : LDLIBS += -lxenstore


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

build: $(TARGETS)

install: build
	install -d $(bindir)
	install -s $(TARGETS) $(bindir)

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

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

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

xenlog: xenlog.o
xenwatch: xenwatch.o xs_view.o xs_store.o xd_view.o xd_store.o tcp.o mdns.o
mdns-browser: mdns-browser.o mdns.o
mdns-publish-xendom: mdns-publish-xendom.o

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