############################################################################### ############################################################################### ## ## Copyright (C) 2009 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. ## ############################################################################### ############################################################################### include ../Makefile.top # # Modular information # with_modules=@modules@ TARGETS=fence_virtd MAIN_LIBS=-L../config -lsimpleconfig -ldl AIS_LIBS=-L/usr/lib64/openais -lSaCkpt COROSYNC_LIBS=-L/usr/lib64/corosync -lcpg CMAN_LIBS=-lcman VIRT_LIBS=-lvirt VIRT_QPID=-lqmfconsole NSS_LIBS=-lnss3 INCLUDES=-I../include `nss-config --cflags` `nspr-config --cflags` LIBS+=-L../common -lfence_virt -Wl,-wrap,syslog,-wrap,closelog -lpthread MODULE_PATH=${libdir}/${PACKAGE_NAME} # # Module sources # fence_virtd_SOURCES = main.c plugin.c libvirt_so_SOURCES = libvirt.c null_so_SOURCES = null.c libvirt_qpid_so_SOURCES = uuid-test.c libvirt_qpid_cxx_so_SOURCES = libvirt-qpid.cpp multicast_so_SOURCES = mcast.c history.c checkpoint_so_SOURCES = virt.c vm_states.c history.c checkpoint.c cpg.c ################################ ifeq ($(with_modules),yes) mod_null=@mod_null@ mod_libvirt=@mod_libvirt@ mod_checkpoint=@mod_checkpoint@ mod_libvirt_qpid=@mod_libvirt_qpid@ mod_multicast=@mod_multicast@ mod_serial=@mod_serial@ # XXX Not done yet ################# # Modular build # ################# CFLAGS+=-D_MODULE -DMODULE_PATH=\"${MODULE_PATH}\" MODULES= ifneq ($(mod_libvirt),no) MODULES+=libvirt.so endif ifneq ($(mod_checkpoint),no) MODULES+=checkpoint.so endif ifneq ($(mod_libvirt_qpid),no) MODULES+=libvirt-qpid.so endif ifneq ($(mod_multicast),no) MODULES+=multicast.so endif ifneq ($(mod_null),no) MODULES+=null.so endif else #################### # Monolithic build # #################### ifneq ($(mod_libvirt),no) fence_virtd_SOURCES+=${libvirt_so_SOURCES} LIBS+=$(VIRT_LIBS) endif ifneq ($(mod_checkpoint),no) fence_virtd_SOURCES+=${checkpoint_so_SOURCES} LIBS+=$(AIS_LIBS) $(COROSYNC_LIBS) $(CMAN_LIBS) endif ifneq ($(mod_libvirt_qpid),no) fence_virtd_SOURCES+=${libvirt_qpid_so_SOURCES} fence_virtd_cxx_SOURCES+=${libvirt_qpid_cxx_so_SOURCES} LIBS+=$(VIRT_QPID) endif ifneq ($(mod_multicast),no) fence_virtd_SOURCES+=${multicast_so_SOURCES} LIBS+=$(AIS_LIBS) $(NSS_LIBS) endif ifneq ($(mod_null),no) fence_virtd_SOURCES+=${null_so_SOURCES} endif endif CFLAGS+=-DSYSCONFDIR=\"@sysconfdir@\" all: ${TARGETS} ${MODULES} fence_virtd: ${fence_virtd_SOURCES:.c=.o} ${fence_virtd_cxx_SOURCES:.cpp=.opp} $(CXX) -o $@ $^ $(MAIN_LIBS) $(LIBS) multicast.so: ${multicast_so_SOURCES:.c=.o} $(CC) -o $@ $^ $(LIBS) -shared $(NSS_LIBS) libvirt.so: ${libvirt_so_SOURCES:.c=.o} $(CC) -o $@ $^ $(LIBS) -shared $(VIRT_LIBS) libvirt-qpid.so: ${libvirt_qpid_so_SOURCES:.c=.o} ${libvirt_qpid_cxx_so_SOURCES:.cpp=.opp} $(CXX) -o $@ $^ $(LIBS) -shared $(VIRT_QPID) null.so: ${null_so_SOURCES:.c=.o} $(CC) -o $@ $^ $(LIBS) -shared checkpoint.so: ${checkpoint_so_SOURCES:.c=.o} $(CC) -o $@ $^ $(LIBS) -shared $(AIS_LIBS) $(VIRT_LIBS) \ $(COROSYNC_LIBS) $(CMAN_LIBS) %.o: %.c $(CC) $(CFLAGS) -c -o $@ $^ $(INCLUDES) %.opp: %.cpp $(CXX) $(CFLAGS) -c -o $@ $^ $(INCLUDES) install: all if [ ! -d ${DESTDIR}/${sbindir} ]; then \ install -d ${DESTDIR}/${sbindir} ; \ fi install -m755 ${TARGETS} ${DESTDIR}/${sbindir} ifeq ($(with_modules),yes) if [ ! -d ${DESTDIR}/${MODULE_PATH} ]; then \ install -d ${DESTDIR}/${MODULE_PATH} ; \ fi install -m755 ${MODULES} ${DESTDIR}/${MODULE_PATH} endif clean: rm -f ${TARGETS} ${MODULES} *.o *.d *~ *.opp