OSDN Git Service

3c6603cc362f7d5c62c1f46a4480c4f3b5ee7d81
[uclinux-h8/uClibc.git] / debian / rules
1 #!/usr/bin/make -f
2 # Sample debian/rules that uses debhelper.
3 # GNU copyright 1997 to 1999 by Joey Hess.
4
5 # Uncomment this to turn on verbose mode.
6 #export DH_VERBOSE=1
7
8 # This is the debhelper compatability version to use.
9 export DH_COMPAT=1
10
11 #include version
12 major=$(shell grep '^MAJOR_VERSION' Rules.mak|sed 's/.*=//')
13 minor=$(shell grep '^MINOR_VERSION' Rules.mak|sed 's/.*=//')
14 version:=$(strip $(major)).$(strip $(minor))
15
16 target=$(DEB_HOST_GNU_CPU)
17 #target=powerpc
18
19 with_shared_libs=y
20 #ifeq ($(target),powerpc)
21 #with_shared_libs=n
22 #endif
23
24 ifneq ($(target),$(DEB_HOST_GNU_CPU))
25 target_suffix=-$(target)
26 endif
27
28 p_dev=libuclibc-dev$(target_suffix)
29 p_lib=libuclibc0$(target_suffix)
30 p_gcc=uclibc$(target_suffix)-gcc
31
32 debian/control: debian/control.in debian/rules
33         sed s/_TARGET_/$(target_suffix)/ debian/control.in >debian/control
34
35 build: build-stamp
36 build-stamp: debian/control
37         dh_testdir
38
39         # Add here commands to compile the package.
40         cp extra/Configs/Config.$(target) Config
41
42         echo '#Debian configuration overrides'  >>Config
43 ifneq ($(target),$(DEB_HOST_GNU_CPU))
44         echo 'TARGET_ARCH = $(target)'  >>Config
45         echo 'CROSS = $(target)-linux-'  >>Config
46 endif
47         echo 'DOPIC = true'  >>Config
48         echo 'PREFIX = /usr'  >>Config
49         echo 'DEVEL_PREFIX = $$(PREFIX)/$$(TARGET_ARCH)-linux-uclibc'  >>Config
50         echo 'TARGET_PREFIX = /'  >>Config
51 ifeq ($(with_shared_libs),n)
52         echo 'HAVE_SHARED = false' >>Config
53 endif
54         echo 'KERNEL_SOURCE = /usr/src/kernel-headers-2.4.5' >>Config
55
56         $(MAKE)
57
58         touch build-stamp
59
60 clean: debian/control
61         dh_testdir
62         dh_testroot
63         rm -f build-stamp
64
65         # Add here commands to clean up after the build process.
66         -$(MAKE) clean
67
68         dh_clean
69
70 install: build debian/control
71         dh_testdir
72         dh_testroot
73         dh_clean -k
74         dh_installdirs
75
76         -rm debian/$(p_dev)
77         ln -s tmp debian/$(p_dev)
78
79         # Add here commands to install the package into debian/tmp.
80         $(MAKE) install_dev DESTDIR=`pwd`/debian/$(p_dev)
81         $(MAKE) install_runtime DESTDIR=`pwd`/debian/$(p_lib)
82         $(MAKE) install_gcc DESTDIR=`pwd`/debian/$(p_gcc)
83
84         install -d debian/$(p_gcc)/usr/share/man/man1
85         install -m 644 debian/uclibc-gcc.1 \
86           debian/$(p_gcc)/usr/share/man/man1/$(target)-uclibc-gcc.1
87         (cd debian/$(p_gcc)/usr/share/man/man1; \
88           ln -sf $(target)-uclibc-gcc.1.gz $(target)-uclibc-cc.1.gz; \
89           ln -sf $(target)-uclibc-gcc.1.gz $(target)-uclibc-ld.1.gz; \
90           for x in addr2line ar as cpp gasp nm objcopy objdump ranlib \
91           size strings strip;do \
92             ln -sf $$x.1.gz $(target)-uclibc-$$x.1.gz;done)
93         
94         install -d debian/$(p_lib)/usr/share/man/man1
95         install -m 644 debian/uclibc-ldd.1 \
96           debian/$(p_lib)/usr/share/man/man1/$(target)-uclibc-ldd.1
97         install -m 644 debian/uclibc-ldconfig.1 \
98           debian/$(p_lib)/usr/share/man/man1/$(target)-uclibc-ldconfig.1
99
100 ifeq ($(with_shared_libs),y)
101 ifeq ($(target),$(DEB_HOST_GNU_CPU))
102         mkdir -p debian/$(p_lib)/lib/
103         ln -sf /usr/$(target)-linux-uclibc/lib/ld-uClibc.so.0 \
104           debian/$(p_lib)/lib/ld-uClibc.so.0
105 endif
106 endif
107         
108         install -d debian/$(p_gcc)/usr/bin
109         mv debian/$(p_gcc)/usr/$(target)-linux-uclibc/bin/$(target)-* \
110                 debian/$(p_gcc)/usr/bin
111         install -d debian/$(p_lib)/usr/bin
112         mv debian/$(p_lib)/usr/$(target)-linux-uclibc/bin/$(target)-* \
113                 debian/$(p_lib)/usr/bin
114
115 # Build architecture-independent files here.
116 binary-indep:
117
118 # Build architecture-dependent files here.
119 binary-arch: build install
120 #       dh_testversion
121         dh_testdir
122         dh_testroot
123
124 #       dh_installdebconf       
125         dh_installdocs
126         dh_installexamples
127         dh_installmenu
128 #       dh_installemacsen
129 #       dh_installpam
130 #       dh_installinit
131         dh_installcron
132 #       dh_installmanpages -plibuclibc0
133         dh_installinfo
134 #       dh_undocumented
135         dh_installchangelogs 
136         dh_link
137         dh_strip
138         dh_compress
139         dh_fixperms -Xld-uClibc
140         # You may want to make some executables suid here.
141 #       dh_suidregister
142 #       dh_makeshlibs
143         dh_installdeb
144 #       dh_perl
145 ifeq ($(target),$(DEB_HOST_GNU_CPU))
146         dh_shlibdeps --exclude=ld_uclibc -ldebian/$(p_lib)/usr/$(target)-linux-uclibc/lib
147 else
148         dh_shlibdeps --exclude=lib
149 endif
150         dh_gencontrol
151         dh_md5sums
152         dh_builddeb
153
154 binary: binary-indep binary-arch
155 .PHONY: build clean binary-indep binary-arch binary install