2 # Copyright (C) 2005-2009 Junjiro Okajima
4 # This program, aufs is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 KDIR
= /lib
/modules
/$(shell uname
-r
)/build
22 CFLAGS
+= -I
${KDIR}/include
25 Cmd
= umount.aufs auchk aubrsync
27 Etc
= etc_default_aufs
28 Bin
= auplink mount.aufs
#auctl
29 BinObj
= $(addsuffix .o
, ${Bin})
34 LibUtilObj
= proc_mnt.o br.o plink.o mtab.o
35 LibUtilHdr
= au_util.h
37 all: ${Man} ${Bin} ${Etc} #${LibSo}
39 ${Bin}: LDFLAGS
+= -static
-s
40 ${Bin}: LDLIBS
= -L.
-lautil
41 ${BinObj}: %.o
: %.c
${LibUtilHdr} ${LibUtil}
43 ${LibUtilObj}: %.o
: %.c
${LibUtilHdr}
44 ${LibUtil}: ${LibUtil}(${LibUtilObj})
46 ${LibSoObj}: CFLAGS
+= -fPIC
47 ${LibSoObj}: %.o
: %.c
${LibSolHdr}
49 # in order to reuse the default rule
50 Dummy
= $(basename $(word 1,${LibSoObj}))
51 ${Dummy}: LDFLAGS
+= --shared
52 ${Dummy}: LDLIBS
+= -ldl
-lpthread
57 etc_default_aufs
: c2sh aufs.shlib
59 echo
'# aufs variables for shell scripts' > $@
62 sed
-e
'0,/^$$/d' aufs.shlib
>> $@
64 aufs
.5: aufs.in
.5 c2tmac
68 gsub(/\140[^\047]*\047/, "\\[oq]&\\[cq]"); \
69 gsub(/\\\[oq\]\140/, "\\[oq]"); \
70 gsub(/\047\\\[cq\]/, "\\[cq]"); \
71 gsub(/\047/, "\\[aq]"); \
76 .INTERMEDIATE
: c2sh c2tmac
78 install_sbin
: File
= mount.aufs umount.aufs auplink
79 install_sbin
: Tgt
= ${DESTDIR}/sbin
80 install_ubin
: File
= auchk aubrsync
#auctl
81 install_ubin
: Tgt
= ${DESTDIR}/usr
/bin
82 install_man
: File
= aufs
.5
83 install_man
: Tgt
= ${DESTDIR}/usr
/share
/man
/man5
84 install_ulib
: Opt
= -s
85 install_ulib
: File
= ${LibSo}
86 install_ulib
: Tgt
= ${DESTDIR}/ulib
87 install_sbin install_ubin install_man install_ulib
: ${File}
89 install -m
755 -o root
-g root
-p
${Opt} ${File} ${Tgt}
90 install_etc
: File
= etc_default_aufs
91 install_etc
: Tgt
= ${DESTDIR}/etc
/default
/aufs
93 install -d
$(dir ${Tgt})
94 install -m
644 -o root
-g root
-p
-T
${File} ${Tgt}
96 # do not inlcude install_ulib here
97 install: install_man install_sbin install_ubin install_etc
100 ${RM} ${Man} ${Bin} ${Etc} ${LibUtil} ${LibSo} *~
101 ${RM} ${BinObj} ${LibUtilObj} ${LibSoObj} ${Dummy}