File: Makefile

package info (click to toggle)
dlm 0.trunk20050206-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 264 kB
  • ctags: 671
  • sloc: ansic: 4,128; makefile: 189; perl: 165
file content (100 lines) | stat: -rw-r--r-- 3,142 bytes parent folder | download
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
###############################################################################
###############################################################################
##
##  Copyright (C) Sistina Software, Inc.  1997-2004  All rights reserved.
##  Copyright (C) 2004 Red Hat, Inc.  All rights reserved.
##  
##  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.
##
###############################################################################
###############################################################################

SOURCE=libdlm.c libaislock.c

LIBNAME=libdlm
SHAREDLIB=$(LIBNAME).so.${RELEASE_MAJOR}.${RELEASE_MINOR} $(LIBNAME)_lt.so.${RELEASE_MAJOR}.${RELEASE_MINOR}
STATICLIB=$(LIBNAME).a $(LIBNAME)_lt.a

top_srcdir=..
UNINSTALL=${top_srcdir}/scripts/uninstall.pl

include ${top_srcdir}/make/defines.mk

CFLAGS += -g -O -I.

ifneq (${KERNEL_SRC}, )
# Use the kernel tree if patched, otherwise, look where cluster headers
#  should be installed
CFLAGS += $(shell if [ -d ${KERNEL_SRC}/include/cluster ]; then \
		echo '-I${KERNEL_SRC}/include/cluster'; else \
		echo '-I${incdir}/cluster'; fi)
else
CFLAGS += -I${incdir}/cluster
endif


all: $(STATICLIB) $(SHAREDLIB)

lib_SOURCES = libdlm.c libaislock.c dlm32.c
lib_lt_SOURCES = libdlm_lt.c dlm32.c

$(LIBNAME).a: $(lib_SOURCES:.c=.po)
	${AR} cr libdlm.a $^
	${RANLIB} libdlm.a 

$(LIBNAME)_lt.a: $(lib_lt_SOURCES:.c=.po)
	${AR} r libdlm_lt.a $^
	${RANLIB} libdlm_lt.a 

$(LIBNAME).so.${RELEASE_MAJOR}.${RELEASE_MINOR}: $(lib_SOURCES:.c=.po)
	$(CC) -shared -o $@ -Wl,-soname=$(LIBNAME).so.$(RELEASE_MAJOR) $^

$(LIBNAME)_lt.so.${RELEASE_MAJOR}.${RELEASE_MINOR}: $(lib_lt_SOURCES:.c=.po)
	$(CC) -shared -o $@ -Wl,-soname=$(LIBNAME)_lt.so.$(RELEASE_MAJOR) $^

%_lt.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $<

%_lt.po: %.c
	$(CC) $(CFLAGS) -fPIC -c -o $@ $<

%.o: %.c
	$(CC) $(CFLAGS) -D_REENTRANT -c -o $@ $<

%.po: %.c
	$(CC) $(CFLAGS) -fPIC -D_REENTRANT -c -o $@ $<

copytobin: all


install: all
	install -d ${incdir}
	install -m644 libdlm.h ${incdir}
	install -d ${libdir}
	install $(LIBNAME).a ${libdir}
	install $(LIBNAME)_lt.a ${libdir}
	install $(LIBNAME).so.$(RELEASE_MAJOR).$(RELEASE_MINOR) ${libdir}
	install $(LIBNAME)_lt.so.$(RELEASE_MAJOR).$(RELEASE_MINOR) ${libdir}
	ln -sf $(LIBNAME).so.$(RELEASE_MAJOR).$(RELEASE_MINOR) ${libdir}/$(LIBNAME).so
	ln -sf $(LIBNAME).so.$(RELEASE_MAJOR).$(RELEASE_MINOR) ${libdir}/$(LIBNAME).so.$(RELEASE_MAJOR)
	ln -sf $(LIBNAME)_lt.so.$(RELEASE_MAJOR).$(RELEASE_MINOR) ${libdir}/$(LIBNAME)_lt.so
	ln -sf $(LIBNAME)_lt.so.$(RELEASE_MAJOR).$(RELEASE_MINOR) ${libdir}/$(LIBNAME)_lt.so.$(RELEASE_MAJOR)

uninstall:
	${UNINSTALL} libdlm.h ${incdir}
	${UNINSTALL} \
		${LIBNAME}.a \
		${LIBNAME}_lt.a \
		$(LIBNAME).so \
		$(LIBNAME)_lt.so \
		$(LIBNAME).so.$(RELEASE_MAJOR) \
		${LIBNAME}.so.$(RELEASE_MAJOR).$(RELEASE_MINOR) ${libdir} \
		$(LIBNAME)_lt.so.$(RELEASE_MAJOR) \
		${LIBNAME}_lt.so.$(RELEASE_MAJOR).$(RELEASE_MINOR) ${libdir}
	rm -f /lib/${LIBNAME}.*

clean:
	rm -f *.o *.a *.so *.so.* *.po
	rm -f *~