chiark / gitweb /
0aac146a8789781098c429a0f514f9162a27716e
[elogind.git] / extras / multipath / Makefile
1 # Makefile
2 #
3 # Copyright (C) 2003 Christophe Varoqui, <christophe.varoqui@free.fr>
4
5 EXEC = multipath
6
7 prefix      = 
8 exec_prefix = ${prefix}
9 bindir      = ${exec_prefix}/sbin
10 udevdir     = ../..
11 klibcdir    = $(udevdir)/klibc
12 sysfsdir    = $(udevdir)/libsysfs
13
14 CC = gcc
15 GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"}
16 CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \
17          -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \
18          -I$(GCCINCDIR) -I$(KERNEL_DIR)/include -I$(sysfsdir) -I.
19
20 OBJS = main.o
21 CRT0 = ../../klibc/klibc/crt0.o
22 LIB = ../../klibc/klibc/libc.a
23 LIBGCC := $(shell $(CC) -print-libgcc-file-name )
24
25 DMOBJS = libdevmapper/libdm-common.o libdevmapper/ioctl/libdevmapper.o
26 SYSFSOBJS = ../../libsysfs/dlist.o ../../libsysfs/sysfs_bus.o \
27             ../../libsysfs/sysfs_class.o ../../libsysfs/sysfs_device.o \
28             ../../libsysfs/sysfs_dir.o ../../libsysfs/sysfs_driver.o \
29             ../../libsysfs/sysfs_utils.o
30
31 SUBDIRS = libdevmapper
32
33 recurse:
34         @for dir in $(SUBDIRS); do\
35         $(MAKE) KERNEL_DIR=$(KERNEL_DIR) -C $$dir ; \
36         done
37         $(MAKE) $(EXEC)
38
39 all:    recurse
40         @echo ""
41         @echo "Make complete"
42
43
44 $(EXEC): $(OBJS)
45         $(LD) -o $(EXEC) $(CRT0) $(OBJS) $(SYSFSOBJS) $(DMOBJS) $(LIB) $(LIBGCC)
46         strip $(EXEC)
47
48 clean:
49         rm -f core *.o $(EXEC)
50         $(MAKE) -C libdevmapper clean
51
52 install:
53         install -d $(bindir)
54         install -m 755 $(EXEC) $(bindir)/
55         install -d /etc/hotplug.d/scsi/
56         install -m 755 multipath.hotplug /etc/hotplug.d/scsi/
57
58 uninstall:
59         rm /etc/hotplug.d/scsi/multipath.hotplug
60         rm $(bindir)/$(EXEC)
61
62 # Code dependencies
63 main.o: main.c main.h sg_include.h