OSDN Git Service

Changes to build cross-compiling libraries
[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
33         sed s/_TARGET_/$(target_suffix)/ debian/control.in >debian/control
34
35 build: build-stamp
36 build-stamp:
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 = $$(DESTDIR)/usr'  >>Config
49         echo 'DEVEL_PREFIX = $$(PREFIX)/$$(TARGET_ARCH)-linux-uclibc'  >>Config
50         echo 'TARGET_PREFIX = $$(DESTDIR)/'  >>Config
51 ifeq ($(with_shared_libs),n)
52         echo 'HAVE_SHARED = false' >>Config
53 endif
54
55         $(MAKE)
56
57         touch build-stamp
58
59 clean:
60         dh_testdir
61         dh_testroot
62         rm -f build-stamp
63
64         # Add here commands to clean up after the build process.
65         -$(MAKE) clean
66
67         dh_clean
68
69 install: build debian/control
70         dh_testdir
71         dh_testroot
72         dh_clean -k
73         dh_installdirs
74
75         -rm debian/$(p_dev)
76         ln -s tmp debian/$(p_dev)
77
78         # Add here commands to install the package into debian/tmp.
79         $(MAKE) install_dev DESTDIR=`pwd`/debian/$(p_dev)
80         $(MAKE) install_runtime DESTDIR=`pwd`/debian/$(p_lib)
81         $(MAKE) install_gcc DESTDIR=`pwd`/debian/$(p_gcc)
82
83         install -d debian/$(p_gcc)/usr/share/man/man1
84         install -m 644 debian/uclibc-gcc.1 \
85           debian/$(p_gcc)/usr/share/man/man1/$(target)-uclibc-gcc.1
86         (cd debian/$(p_gcc)/usr/share/man/man1; \
87           ln -sf $(target)-uclibc-gcc.1.gz $(target)-uclibc-cc.1.gz; \
88           ln -sf $(target)-uclibc-gcc.1.gz $(target)-uclibc-ld.1.gz; \
89           for x in addr2line ar as cpp gasp nm objcopy objdump ranlib \
90           size strings strip;do \
91             ln -sf $$x.1.gz $(target)-uclibc-$$x.1.gz;done)
92         
93         install -d debian/$(p_lib)/usr/share/man/man1
94         install -m 644 debian/uclibc-ldd.1 \
95           debian/$(p_lib)/usr/share/man/man1/$(target)-uclibc-ldd.1
96         install -m 644 debian/uclibc-ldconfig.1 \
97           debian/$(p_lib)/usr/share/man/man1/$(target)-uclibc-ldconfig.1
98
99 ifeq ($(with_shared_libs),y)
100 ifeq ($(target),$(DEB_HOST_GNU_CPU))
101         mkdir -p debian/$(p_lib)/lib/
102         ln -sf /usr/$(target)-uclibc-linux/lib/ld-uClibc.so.0 \
103           debian/$(p_lib)/lib/ld-uClibc.so.0
104 endif
105 endif
106
107 # Build architecture-independent files here.
108 binary-indep:
109
110 # Build architecture-dependent files here.
111 binary-arch: build install
112 #       dh_testversion
113         dh_testdir
114         dh_testroot
115
116 #       dh_installdebconf       
117         dh_installdocs
118         dh_installexamples
119         dh_installmenu
120 #       dh_installemacsen
121 #       dh_installpam
122 #       dh_installinit
123         dh_installcron
124 #       dh_installmanpages -plibuclibc0
125         dh_installinfo
126 #       dh_undocumented
127         dh_installchangelogs 
128         dh_link
129         dh_strip
130         dh_compress
131         dh_fixperms -Xld-uClibc
132         # You may want to make some executables suid here.
133 #       dh_suidregister
134 #       dh_makeshlibs
135         dh_installdeb
136 #       dh_perl
137 ifeq ($(target),$(DEB_HOST_GNU_CPU))
138         dh_shlibdeps --exclude=ld_uclibc -ldebian/$(p_lib)/usr/$(target)-linux-uclibc/lib
139 else
140         dh_shlibdeps --exclude=lib
141 endif
142         dh_gencontrol
143         dh_md5sums
144         dh_builddeb
145
146 binary: binary-indep binary-arch
147 .PHONY: build clean binary-indep binary-arch binary install