2009-07-28 18:46:53 +04:00
###############################################################################
###############################################################################
##
## Copyright (C) 2006 Red Hat, Inc.
##
## This copyrighted material is made available to anyone wishing to use,
## modify, copy, or redistribute it subject to the terms and conditions
## of the GNU General Public License v.2.
##
###############################################################################
###############################################################################
2009-08-17 17:58:06 +04:00
i n c l u d e . . / M a k e f i l e . t o p
2009-07-28 18:46:53 +04:00
2009-09-15 23:17:14 +04:00
#
# Modular information
#
with_modules = @modules@
2009-07-28 18:46:53 +04:00
2009-08-21 22:05:48 +04:00
TARGETS = fence_virtd
2009-09-15 23:17:14 +04:00
MAIN_LIBS = -L../config -lsimpleconfig -ldl
AIS_LIBS = -L@libdir@/openais -lSaCkpt
COROSYNC_LIBS = -L@libdir@/corosync -lcpg
VIRT_LIBS = -lvirt
NSS_LIBS = -lnss3
INCLUDES = -I../include ` nss-config --cflags` ` nspr-config --cflags`
LIBS += -L../common -lfence_virt -Wl,-wrap,syslog,-wrap,closelog -lpthread
2009-08-21 22:05:48 +04:00
2009-09-15 23:17:14 +04:00
MODULE_PATH = ${ libdir } /${ PACKAGE_NAME }
2009-08-17 17:58:06 +04:00
2009-09-15 23:17:14 +04:00
#
# Module sources
#
2009-09-02 02:54:17 +04:00
fence_virtd_SOURCES = main.c plugin.c
2009-08-17 17:58:06 +04:00
libvirt_so_SOURCES = libvirt.c
2009-09-02 03:11:15 +04:00
null_so_SOURCES = null.c
2009-09-14 23:06:38 +04:00
multicast_so_SOURCES = mcast.c history.c
2009-09-15 23:40:41 +04:00
checkpoint_so_SOURCES = virt.c vm_states.c history.c checkpoint.c cpg.c
2009-08-20 23:03:41 +04:00
2009-07-28 18:46:53 +04:00
2009-09-15 23:17:14 +04:00
################################
i f e q ( $( with_modules ) , y e s )
mod_null = @mod_null@
mod_libvirt = @mod_libvirt@
mod_checkpoint = @mod_checkpoint@
mod_multicast = @mod_multicast@
mod_serial = @mod_serial@ # XXX Not done yet
#################
# Modular build #
#################
CFLAGS += -D_MODULE -DMODULE_PATH= \" ${ MODULE_PATH } \"
MODULES =
i f n e q ( $( mod_libvirt ) , n o )
MODULES += libvirt.so
e n d i f
i f n e q ( $( mod_checkpoint ) , n o )
MODULES += checkpoint.so
e n d i f
i f n e q ( $( mod_multicast ) , n o )
MODULES += multicast.so
e n d i f
i f n e q ( $( mod_null ) , n o )
MODULES += null.so
e n d i f
e l s e
####################
# Monolithic build #
####################
i f n e q ( $( mod_libvirt ) , n o )
fence_virtd_SOURCES += ${ libvirt_so_SOURCES }
LIBS += $( VIRT_LIBS)
e n d i f
i f n e q ( $( mod_checkpoint ) , n o )
fence_virtd_SOURCES += ${ checkpoint_so_SOURCES }
LIBS += $( AIS_LIBS) $( COROSYNC_LIBS)
e n d i f
i f n e q ( $( mod_multicast ) , n o )
fence_virtd_SOURCES += ${ multicast_so_SOURCES }
LIBS += $( AIS_LIBS) $( NSS_LIBS)
e n d i f
i f n e q ( $( mod_null ) , n o )
fence_virtd_SOURCES += ${ null_so_SOURCES }
e n d i f
e n d i f
CFLAGS += -DSYSCONFDIR= \" @sysconfdir@\"
2009-07-28 18:46:53 +04:00
2009-08-21 22:05:48 +04:00
all : ${TARGETS } ${MODULES }
2009-07-28 18:46:53 +04:00
fence_virtd : ${fence_virtd_SOURCES :.c =.o }
2009-09-15 23:17:14 +04:00
$( CC) -o $@ $^ $( LIBS) $( MAIN_LIBS)
2009-07-28 18:46:53 +04:00
2009-09-02 02:54:17 +04:00
multicast.so : ${multicast_so_SOURCES :.c =.o }
2009-09-15 23:17:14 +04:00
$( CC) -o $@ $^ $( LIBS) -shared $( NSS_LIBS)
2009-09-02 02:54:17 +04:00
2009-08-17 17:58:06 +04:00
libvirt.so : ${libvirt_so_SOURCES :.c =.o }
2009-09-15 23:17:14 +04:00
$( CC) -o $@ $^ $( LIBS) -shared $( VIRT_LIBS)
2009-08-17 17:58:06 +04:00
2009-09-02 03:11:15 +04:00
null.so : ${null_so_SOURCES :.c =.o }
2009-09-15 23:17:14 +04:00
$( CC) -o $@ $^ $( LIBS) -shared
2009-09-02 03:11:15 +04:00
2009-08-20 23:03:41 +04:00
checkpoint.so : ${checkpoint_so_SOURCES :.c =.o }
2009-09-15 23:17:14 +04:00
$( CC) -o $@ $^ $( LIBS) -shared $( AIS_LIBS) $( VIRT_LIBS) $( COROSYNC_LIBS)
2009-08-20 23:03:41 +04:00
2009-07-28 18:46:53 +04:00
%.o : %.c
2009-09-15 23:17:14 +04:00
$( CC) $( CFLAGS) -c -o $@ $^ $( INCLUDES)
2009-07-28 18:46:53 +04:00
install : all
2009-09-17 23:16:24 +04:00
if [ ! -d ${ DESTDIR } /${ sbindir } ] ; then \
install -d ${ DESTDIR } /${ sbindir } ; \
2009-07-28 18:46:53 +04:00
fi
2009-09-17 23:16:24 +04:00
install -m755 ${ TARGETS } ${ DESTDIR } /${ sbindir }
2009-09-15 23:17:14 +04:00
i f e q ( $( with_modules ) , y e s )
2009-09-17 23:16:24 +04:00
if [ ! -d ${ DESTDIR } /${ MODULE_PATH } ] ; then \
install -d ${ DESTDIR } /${ MODULE_PATH } ; \
2009-08-21 22:12:58 +04:00
fi
2009-09-17 23:16:24 +04:00
install -m755 ${ MODULES } ${ DESTDIR } /${ MODULE_PATH }
2009-09-15 23:17:14 +04:00
e n d i f
2009-07-28 18:46:53 +04:00
clean :
2009-09-02 00:23:09 +04:00
rm -f ${ TARGETS } ${ MODULES } *.o *.d *~