File: Makefile

package info (click to toggle)
libpmount 0.0.13
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 104 kB
  • ctags: 46
  • sloc: ansic: 595; makefile: 103
file content (59 lines) | stat: -rw-r--r-- 1,243 bytes parent folder | download | duplicates (2)
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
#
# libpmount Makefile
#

CFLAGS = -Wall -g
MK_CFLAGS = -D_REENTRANT -DUSE_LOOP

LIBNAME = libpmount
SOVERSION = 0.0
SONAME = $(LIBNAME).so.$(SOVERSION)
STNAME = $(LIBNAME).a

SRCS = $(addprefix src/,kerndep.c mtab.c pmount.c)
SH_OBJS = $(SRCS:.c=.lo)
ST_OBJS = $(SRCS:.c=.o)

%.lo: %.c
	$(CC) $(CFLAGS) $(MK_CFLAGS) -fPIC -c -o $@ $<

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

build: $(SONAME) $(STNAME)

$(STNAME): $(ST_OBJS)
	$(AR) cru $@ $^

$(SONAME): $(SH_OBJS)
	$(CC) -shared \
	  -Wl,-z,defs \
	  -Wl,-soname -Wl,$(SONAME) \
	  -Wl,--version-script=Versions \
	  -o $@ $^

check: build
	# check if we are root, and it's not fake
	if test `id -u` = 0 && test -z "$(FAKEROOTKEY)"; then \
	  $(MAKE) -C tests; \
	else \
	  echo "Not running as root, skipping checks."; \
	fi

install: build
	mkdir -p $(DESTDIR)/usr/include
	mkdir -p $(DESTDIR)/usr/lib
	mkdir -p $(DESTDIR)/lib
	install -m644 src/pmount.h $(DESTDIR)/usr/include/
	install -s -m755 $(SONAME) $(DESTDIR)/lib/
	install -m755 $(STNAME) $(DESTDIR)/usr/lib/
	ln -s /lib/$(LIBNAME).so.0 $(DESTDIR)/usr/lib/$(LIBNAME).so
	ln -s $(SONAME) $(DESTDIR)/lib/$(LIBNAME).so.0

clean:
	$(RM) $(ST_OBJS)
	$(RM) $(SH_OBJS)
	$(RM) $(SONAME)
	$(RM) $(STNAME)
	$(MAKE) -C tests $@