Clean up RPM spec for newer distributions
[clumanager.git] / librhcm / Makefile
blobaa9d7dcd6598607e74a2f1b6d7dcc680369c207a
1 include ../Makefile.top
3 CFLAGS += -DCLU_CONFIG_FILE=\"$(CLU_CONFIG_FILE)\"
4 SUBDIRS = man
5 INCLUDES = -I. -I/usr/include/libxml2 -I../include
6 LIBS = -L. -lrhcm -lpthread -lxml2
7 STATICLIBS = librhcm.a libxmlcfg.a libxmlcfg_lite.a
8 DYNLIB = librhcm.so.$(VERSION)
9 DYNLINK = librhcm.so
10 DYNLIBS = $(DYNLIB) $(DYNLINK)
11 ALLLIBS = $(STATICLIBS) $(DYNLIBS)
12 OBJS = membership.o quorum.o api.o bitmap.o apitcp.o auth_md5.o md5.o \
13 binhex.o
14 CFGOBJS = xmlconfig.o xmlwrap.o
15 CFGLITEOBJS= xmlconfig.o xmlwrap_lite.o
17 all: libs
18 for subdir in $(SUBDIRS); do make -C $$subdir || exit 1; done
20 demo: libs clumq authtest
22 authtest: auths authc
24 auths: auth_md5.c md5.o
25 $(CC) -o $@ auth_md5.c md5.o $(CFLAGS) $(INCLUDES) -DSTANDALONE -DSERVER \
26 -DDEBUG
28 authc: auth_md5.c md5.o
29 $(CC) -o $@ auth_md5.c md5.o $(CFLAGS) $(INCLUDES) -DSTANDALONE -DDEBUG
31 demo-clean:
32 rm -f clumq auths authc
34 dynamic-clean:
35 rm -f $(DYNLIBS)
37 static-clean:
38 rm -f $(STATICLIBS)
40 dynamic-libs: $(DYNLIBS)
42 static-libs: $(STATICLIBS)
44 clumq: sizes.h clumq.o
45 gcc -o clumq clumq.o -L. -static -lrhcm -dynamic -lpthread
47 libs: $(ALLLIBS)
49 clean: demo-clean
50 for subdir in $(SUBDIRS); do make -C $$subdir clean || exit 1; done
51 rm -f *.o *~ *.a *.so *.so.* $(TARGETS)
53 install:
54 for subdir in $(SUBDIRS); do make -C $$subdir install || exit 1; done
55 mkdir -p $(DESTDIR)/usr/include/rhcm
56 install -m 0644 cm_api.h $(DESTDIR)/usr/include/rhcm
57 install -m 0644 sizes.h $(DESTDIR)/usr/include/rhcm
58 install -m 0644 platform.h $(DESTDIR)/usr/include/rhcm
59 mkdir -p $(DESTDIR)/usr/share/doc/librhcm-$(VERSION)
60 install -m 0644 COPYING $(DESTDIR)/usr/share/doc/librhcm-$(VERSION)
61 install -m 0644 librhcm.a $(DESTDIR)/usr/lib
62 install -m 0755 $(DYNLIBS) $(DESTDIR)/usr/lib
64 libs: librhcm.so.$(VERSION)
66 librhcm.a: sizes.h $(OBJS)
67 ar rc $@ $(OBJS)
70 # Internal Builds should link statically against libxmlcfg;
71 # The dynamic lib. only reads from local storage, not shared
72 # storage. The dynamic lib needs to read the config so that
73 # user apps can benefit/use the transparent challenge/response
74 # authentication stuff.
76 librhcm.so.$(VERSION): sizes.h $(OBJS) $(CFGLITEOBJS)
77 $(CC) -shared -o $@ $(OBJS) $(CFGLITEOBJS)
79 librhcm.so: sizes.h librhcm.so.$(VERSION)
80 ln -snf librhcm.so.$(VERSION) $@
83 # We generate this at build time.
85 sizes.h: sizes.h.in
86 cat $^ > $@
87 echo "int main(void) { printf(\"%d\\n\",sizeof(void *)); }" > ptrsize.c
88 echo "int main(void) { printf(\"%d\\n\",sizeof(int)); }" > intsize.c
89 gcc -o ptrsize ptrsize.c
90 gcc -o intsize intsize.c
91 echo "#ifndef __SIZES_H" >> $@
92 echo "#define __SIZES_H" >> $@
93 echo "#define __PTR_SIZE `./ptrsize`" >> $@
94 echo "#define __INT_SIZE `./ptrsize`" >> $@
95 echo "#endif /* __SIZES_H */" >> $@
97 rm -f ptrsize* intsize*
100 # Config library without shared state support
101 # We shouldn't depend on shared state generally.
103 libxmlcfg_lite.a: $(CFGLITEOBJS)
104 ar rc $@ $^
106 libxmlcfg.a: $(CFGOBJS)
107 ar rc $@ $^
109 xmlwrap_lite.o: xmlwrap.c xmlwrap.h xmlconfig.h
110 $(CC) $(CFLAGS) -o $@ -c xmlwrap.c $(INCLUDES) -DNO_SHARED_IO
112 %.o: %.c
113 $(CC) -c -o $@ $^ $(CFLAGS) $(INCLUDES)