Makefile 2.9 KB

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