rules 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. #!/usr/bin/make -f
  2. # Sample debian/rules that uses debhelper.
  3. # GNU copyright 1997 to 1999 by Joey Hess.
  4. # Uncomment this to turn on verbose mode.
  5. #export DH_VERBOSE=1
  6. # This is the debhelper compatability version to use.
  7. export DH_COMPAT=3
  8. #include version
  9. major=$(shell grep '^MAJOR_VERSION' Rules.mak|sed 's/.*=//')
  10. minor=$(shell grep '^MINOR_VERSION' Rules.mak|sed 's/.*=//')
  11. version:=$(strip $(major)).$(strip $(minor))
  12. kernel_version=2.4.22
  13. kernel_source=kernel-source-$(kernel_version)
  14. builddir=$(shell pwd)
  15. target=$(DEB_HOST_GNU_CPU)
  16. with_shared_libs=y
  17. ifeq ($(with_shared_libs),y)
  18. shared_libs_true=true
  19. else
  20. shared_libs_true=false
  21. endif
  22. ifneq ($(target),$(DEB_HOST_GNU_CPU))
  23. target_suffix=-$(target)
  24. endif
  25. ifneq ($(target),$(DEB_HOST_GNU_CPU))
  26. cross_options = --cross="$(target)-linux-"
  27. else
  28. cross_options = --cross=""
  29. endif
  30. p_dev=uclibc-dev$(target_suffix)
  31. p_lib=uclibc$(target_suffix)
  32. build: build-stamp
  33. build-stamp:
  34. dh_testdir
  35. # Brute force method of getting kernel headers
  36. tar --bzip2 -xf /usr/src/$(kernel_source).tar.bz2 \
  37. $(kernel_source)/include
  38. # Hack to get include/asm-arm/arch directory. This should
  39. # stay here, and not move to the top-level Makefile, since
  40. # it adds a link _in the kernel source_, which is almost
  41. # certainly wrong in most situations.
  42. #ifeq ($(target),arm)
  43. ln -s arch-sa1100 $(kernel_source)/include/asm-arm/arch
  44. ln -s proc-armo $(kernel_source)/include/asm-arm/proc
  45. #endif
  46. touch $(kernel_source)/include/linux/autoconf.h
  47. # Various stupid programs use linux/version.h to find the
  48. # Linux version.
  49. ( \
  50. echo '#define UTS_RELEASE "$(kernel_version)"'; \
  51. echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
  52. echo '#define LINUX_VERSION_CODE KERNEL_VERSION($(shell echo $(kernel_version) | sed s/\\./,/g))'; \
  53. ) >$(kernel_source)/include/linux/version.h
  54. cp debian/config .config
  55. sed -ie 's,^.*TARGET_$(target).*,TARGET_$(target)=y,g' \
  56. .config
  57. sed -ie 's,^TARGET_ARCH.*,TARGET_ARCH=\"$(target)\",g' \
  58. .config
  59. sed -ie 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(builddir)/$(kernel_source)\",g' \
  60. .config
  61. sed -ie 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' \
  62. .config
  63. sed -ie 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g' \
  64. .config
  65. sed -ie 's,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g' \
  66. .config
  67. sed -ie 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y\nUCLIBC_HAS_LOCALE=n,g' \
  68. .config
  69. #ifeq ($(target),arm)
  70. sed -ie 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' .config
  71. echo CONFIG_GENERIC_ARM=y >>.config
  72. #endif
  73. #ifeq ($(target),i386)
  74. echo CONFIG_GENERIC_386=y >>.config
  75. #endif
  76. yes '' | make oldconfig
  77. mkdir -p lib
  78. $(MAKE)
  79. $(MAKE) utils
  80. touch build-stamp
  81. clean:
  82. dh_testdir
  83. dh_testroot
  84. rm -f build-stamp
  85. rm -rf kernel-source-*
  86. # Add here commands to clean up after the build process.
  87. -$(MAKE) distclean
  88. -rm -f Config
  89. dh_clean
  90. install: build
  91. dh_testdir
  92. dh_testroot
  93. dh_clean -k
  94. dh_installdirs
  95. -rm debian/tmp
  96. -mkdir debian/tmp
  97. # Add here commands to install the package into debian/tmp.
  98. $(MAKE) install install_utils PREFIX=`pwd`/debian/tmp
  99. install -d debian/tmp/usr/share/man/man1
  100. install -m 644 debian/ldd.1 \
  101. debian/tmp/usr/share/man/man1/ldd.1
  102. install -m 644 debian/ldconfig.1 \
  103. debian/tmp/usr/share/man/man1/ldconfig.1
  104. # Build architecture-independent files here.
  105. binary-indep:
  106. # Build architecture-dependent files here.
  107. binary-arch: build install
  108. # dh_testversion
  109. dh_testdir
  110. dh_testroot
  111. dh_movefiles
  112. # dh_installdebconf
  113. dh_installdocs
  114. dh_installexamples
  115. dh_installmenu
  116. # dh_installemacsen
  117. # dh_installpam
  118. # dh_installinit
  119. dh_installcron
  120. # dh_installmanpages -puclibc
  121. dh_installinfo
  122. # dh_undocumented
  123. dh_installchangelogs
  124. dh_link
  125. dh_strip
  126. dh_compress
  127. dh_fixperms -Xld-uClibc
  128. # You may want to make some executables suid here.
  129. # dh_suidregister
  130. # dh_makeshlibs
  131. dh_installdeb
  132. # dh_perl
  133. dh_shlibdeps --exclude=lib
  134. dh_gencontrol
  135. dh_md5sums
  136. dh_builddeb
  137. binary: binary-indep binary-arch
  138. .PHONY: build clean binary-indep binary-arch binary install