Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. # for SGlinux builds
  2. -include $(ROOTDIR)/modules/.config
  3. OCF_OBJS = crypto.o criov.o
  4. ifdef CONFIG_OCF_RANDOMHARVEST
  5. OCF_OBJS += random.o
  6. endif
  7. ifdef CONFIG_OCF_FIPS
  8. OCF_OBJS += rndtest.o
  9. endif
  10. # Add in autoconf.h to get #defines for CONFIG_xxx
  11. AUTOCONF_H=$(ROOTDIR)/modules/autoconf.h
  12. ifeq ($(AUTOCONF_H), $(wildcard $(AUTOCONF_H)))
  13. EXTRA_CFLAGS += -include $(AUTOCONF_H)
  14. export EXTRA_CFLAGS
  15. endif
  16. ifndef obj
  17. obj ?= .
  18. _obj = subdir
  19. mod-subdirs := safe hifn ixp4xx talitos ocfnull
  20. export-objs += crypto.o criov.o random.o
  21. list-multi += ocf.o
  22. _slash :=
  23. else
  24. _obj = obj
  25. _slash := /
  26. endif
  27. EXTRA_CFLAGS += -I$(obj)/.
  28. obj-$(CONFIG_OCF_OCF) += ocf.o
  29. obj-$(CONFIG_OCF_CRYPTODEV) += cryptodev.o
  30. obj-$(CONFIG_OCF_CRYPTOSOFT) += cryptosoft.o
  31. obj-$(CONFIG_OCF_BENCH) += ocf-bench.o
  32. $(_obj)-$(CONFIG_OCF_SAFE) += safe$(_slash)
  33. $(_obj)-$(CONFIG_OCF_HIFN) += hifn$(_slash)
  34. $(_obj)-$(CONFIG_OCF_IXP4XX) += ixp4xx$(_slash)
  35. $(_obj)-$(CONFIG_OCF_TALITOS) += talitos$(_slash)
  36. $(_obj)-$(CONFIG_OCF_PASEMI) += pasemi$(_slash)
  37. $(_obj)-$(CONFIG_OCF_EP80579) += ep80579$(_slash)
  38. $(_obj)-$(CONFIG_OCF_CRYPTOCTEON) += cryptocteon$(_slash)
  39. $(_obj)-$(CONFIG_OCF_KIRKWOOD) += kirkwood$(_slash)
  40. $(_obj)-$(CONFIG_OCF_OCFNULL) += ocfnull$(_slash)
  41. $(_obj)-$(CONFIG_OCF_C7108) += c7108$(_slash)
  42. $(_obj)-$(CONFIG_OCF_UBSEC_SSB) += ubsec_ssb$(_slash)
  43. ocf-objs := $(OCF_OBJS)
  44. dummy:
  45. @echo "Please consult the README for how to build OCF."
  46. @echo "If you can't wait then the following should do it:"
  47. @echo ""
  48. @echo " make ocf_modules"
  49. @echo " sudo make ocf_install"
  50. @echo ""
  51. @exit 1
  52. $(list-multi) dummy1: $(ocf-objs)
  53. $(LD) -r -o $@ $(ocf-objs)
  54. .PHONY:
  55. clean:
  56. rm -f *.o *.ko .*.o.flags .*.ko.cmd .*.o.cmd .*.mod.o.cmd *.mod.c
  57. rm -f */*.o */*.ko */.*.o.cmd */.*.ko.cmd */.*.mod.o.cmd */*.mod.c */.*.o.flags
  58. rm -f */modules.order */modules.builtin modules.order modules.builtin
  59. ifdef TOPDIR
  60. -include $(TOPDIR)/Rules.make
  61. endif
  62. #
  63. # targets to build easily on the current machine
  64. #
  65. ocf_make:
  66. make -C /lib/modules/$(shell uname -r)/build M=`pwd` $(OCF_TARGET) CONFIG_OCF_OCF=m
  67. make -C /lib/modules/$(shell uname -r)/build M=`pwd` $(OCF_TARGET) CONFIG_OCF_OCF=m CONFIG_OCF_CRYPTOSOFT=m
  68. -make -C /lib/modules/$(shell uname -r)/build M=`pwd` $(OCF_TARGET) CONFIG_OCF_OCF=m CONFIG_OCF_BENCH=m
  69. -make -C /lib/modules/$(shell uname -r)/build M=`pwd` $(OCF_TARGET) CONFIG_OCF_OCF=m CONFIG_OCF_OCFNULL=m
  70. -make -C /lib/modules/$(shell uname -r)/build M=`pwd` $(OCF_TARGET) CONFIG_OCF_OCF=m CONFIG_OCF_HIFN=m
  71. ocf_modules:
  72. $(MAKE) ocf_make OCF_TARGET=modules
  73. ocf_install:
  74. $(MAKE) ocf_make OCF_TARGET="modules modules_install"
  75. depmod
  76. mkdir -p /usr/include/crypto
  77. cp cryptodev.h /usr/include/crypto/.
  78. #
  79. # generate full kernel patches for 2.4 and 2.6 kernels to make patching
  80. # your kernel easier
  81. #
  82. .PHONY: patch
  83. patch:
  84. patchbase=.; \
  85. [ -d $$patchbase/patches ] || patchbase=..; \
  86. patch=ocf-linux-base.patch; \
  87. patch24=ocf-linux-24.patch; \
  88. patch26=ocf-linux-26.patch; \
  89. patch3=ocf-linux-3.patch; \
  90. ( \
  91. find . -name Makefile; \
  92. find . -name Config.in; \
  93. find . -name Kconfig; \
  94. find . -name README; \
  95. find . -name '*.[ch]' | grep -v '.mod.c'; \
  96. ) | while read t; do \
  97. diff -Nau /dev/null $$t | sed 's?^+++ \./?+++ linux/crypto/ocf/?'; \
  98. done > $$patch; \
  99. cat $$patchbase/patches/linux-2.4.35-ocf.patch $$patch > $$patch24; \
  100. cat $$patchbase/patches/linux-2.6.38-ocf.patch $$patch > $$patch26; \
  101. cat $$patchbase/patches/linux-3.2.1-ocf.patch $$patch > $$patch3; \
  102. #
  103. # this target probably does nothing for anyone but me - davidm
  104. #
  105. .PHONY: release
  106. release:
  107. REL=`date +%Y%m%d`; RELDIR=/tmp/ocf-linux-$$REL; \
  108. CURDIR=`pwd`; \
  109. rm -rf /tmp/ocf-linux-$$REL*; \
  110. mkdir -p $$RELDIR/ocf; \
  111. mkdir -p $$RELDIR/patches; \
  112. mkdir -p $$RELDIR/crypto-tools; \
  113. cp README* $$RELDIR/.; \
  114. cp patches/[!C]* $$RELDIR/patches/.; \
  115. cp tools/[!C]* $$RELDIR/crypto-tools/.; \
  116. cp -r [!C]* Config.in $$RELDIR/ocf/.; \
  117. rm -rf $$RELDIR/ocf/patches $$RELDIR/ocf/tools; \
  118. rm -f $$RELDIR/ocf/README*; \
  119. cp $$CURDIR/../../user/crypto-tools/[!C]* $$RELDIR/crypto-tools/.; \
  120. make -C $$RELDIR/crypto-tools clean; \
  121. make -C $$RELDIR/ocf clean; \
  122. find $$RELDIR/ocf -name CVS | xargs rm -rf; \
  123. cd $$RELDIR/..; \
  124. tar cvf ocf-linux-$$REL.tar ocf-linux-$$REL; \
  125. gzip -9 ocf-linux-$$REL.tar