1 # Makefile for the NSLU2 Linux development system
2 # Licensed under the GPL v2 or later
4 # Change these if you are unfortunate enough to have a split net personality.
7 SVN_SSH ?
= "-l ${SVN_USER}"
9 HOST_MACHINE
:=$(shell uname
-m | sed \
10 -e
's/i[3-9]86/i386/' \
11 -e
's/armv5teb/armeb/' \
12 -e
's/armv5b/armeb/' \
15 HOST_FIRMWARE
:=$(shell uname
-m | sed \
16 -e
's/i[3-9]86/Linux/' \
17 -e
's/armv5teb/OpenSlug/' \
18 -e
's/armv5b/Unslung/' \
25 prefetch
: prefetch-unslung prefetch-openslug prefetch-ucslugc prefetch-optware
28 build
: build-unslung build-openslug build-ucslugc build-optware
31 ifneq ($(HOST_MACHINE
),armeb
)
32 setup
: setup-master setup-bitbake setup-openembedded setup-unslung setup-openslug setup-ucslugc setup-optware
34 ifeq ($(HOST_FIRMWARE
),OpenSlug
)
35 setup
: setup-master setup-bitbake setup-openembedded setup-openslug
37 setup
: setup-master setup-optware
41 .PHONY
: setup-developer
42 setup-developer
: setup-master setup-bitbake setup-openembedded setup-optware-developer
45 ifneq ($(HOST_MACHINE
),armeb
)
46 update
: update-master update-bitbake update-openembedded update-optware
48 ifeq ($(HOST_FIRMWARE
),OpenSlug
)
49 update
: update-master update-bitbake update-openembedded
51 update
: update-master update-optware
56 status
: status-master status-bitbake status-openembedded status-optware
59 clobber: clobber-unslung clobber-openslug clobber-ucslugc clobber-optware
62 distclean: distclean-master distclean-bitbake distclean-openembedded \
63 distclean-unslung distclean-openslug distclean-ucslugc distclean-optware distclean-releases
65 .PHONY
: prefetch-unslung
66 ifneq ($(HOST_MACHINE
),armeb
)
67 prefetch-unslung
: unslung
/.configured bitbake
/.configured openembedded
/.configured
68 ( cd unslung
; ${MAKE} prefetch
)
73 .PHONY
: prefetch-openslug
74 ifneq ($(HOST_MACHINE
),armeb
)
75 prefetch-openslug
: openslug
/.configured bitbake
/.configured openembedded
/.configured
76 ( cd openslug
; ${MAKE} prefetch
)
78 ifeq ($(HOST_FIRMWARE
),OpenSlug
)
79 prefetch-openslug
: openslug
/.configured bitbake
/.configured openembedded
/.configured
80 ( cd openslug
; ${MAKE} prefetch
)
86 .PHONY
: prefetch-ucslugc
87 ifneq ($(HOST_MACHINE
),armeb
)
88 prefetch-ucslugc
: ucslugc
/.configured bitbake
/.configured openembedded
/.configured
89 ( cd ucslugc
; ${MAKE} prefetch
)
94 .PHONY
: prefetch-optware
95 prefetch-optware
: prefetch-optware-nslu2 prefetch-optware-wl500g prefetch-optware-ds101 prefetch-optware-ds101g
97 .PHONY
: prefetch-optware-nslu2
98 ifneq ($(HOST_MACHINE
),armeb
)
99 prefetch-optware-nslu2
: optware
/nslu2
/.configured
100 ( cd optware
/nslu2
; ${MAKE} source
)
102 ifeq ($(HOST_FIRMWARE
),Unslung
)
103 prefetch-optware-nslu2
: optware
/nslu2
/.configured
104 ( cd optware
/nslu2
; ${MAKE} source
)
106 prefetch-optware-nslu2
:
110 .PHONY
: prefetch-optware-
%
111 ifneq ($(HOST_MACHINE
),armeb
)
112 prefetch-optware-
%: optware
/%/.configured
113 ( cd optware
/$* ; ${MAKE} source
)
118 prefetch-openslug-
%-beta
: releases
/OpenSlug-
%-beta
/.configured
119 ( cd releases
/OpenSlug-
$*-beta
; ${MAKE} prefetch
)
121 .PHONY
: unslung build-unslung
122 ifneq ($(HOST_MACHINE
),armeb
)
123 unslung build-unslung
: unslung
/.configured bitbake
/.configured openembedded
/.configured
124 ( cd unslung
; ${MAKE} )
126 unslung build-unslung
:
129 .PHONY
: openslug build-openslug
130 ifneq ($(HOST_MACHINE
),armeb
)
131 openslug build-openslug
: openslug
/.configured bitbake
/.configured openembedded
/.configured
132 ( cd openslug
; ${MAKE} )
134 ifeq ($(HOST_FIRMWARE
),OpenSlug
)
135 openslug build-openslug
: openslug
/.configured bitbake
/.configured openembedded
/.configured
136 ( cd openslug
; ${MAKE} )
138 openslug build-openslug
:
142 .PHONY
: ucslugc build-ucslugc
143 ifneq ($(HOST_MACHINE
),armeb
)
144 ucslugc build-ucslugc
: ucslugc
/.configured bitbake
/.configured openembedded
/.configured
145 ( cd ucslugc
; ${MAKE} )
147 ucslugc build-ucslugc
:
150 .PHONY
: unslung-image build-unslung-image
151 ifneq ($(HOST_MACHINE
),armeb
)
152 unslung-image build-unslung-image
: unslung
/.configured bitbake
/.configured openembedded
/.configured
153 ( cd unslung
; ${MAKE} image
)
155 unslung-image build-unslung-image
:
158 .PHONY
: openslug-image build-openslug-image
159 ifneq ($(HOST_MACHINE
),armeb
)
160 openslug-image build-openslug-image
: openslug
/.configured bitbake
/.configured openembedded
/.configured
161 ( cd openslug
; ${MAKE} image
)
163 openslug-image build-openslug-image
:
166 .PHONY
: ucslugc-image build-ucslugc-image
167 ifneq ($(HOST_MACHINE
),armeb
)
168 ucslugc-image build-ucslugc-image
: ucslugc
/.configured bitbake
/.configured openembedded
/.configured
169 ( cd ucslugc
; ${MAKE} image
)
171 ucslugc-image build-ucslugc-image
:
174 .PHONY
: unslung-kernel build-unslung-kernel
175 ifneq ($(HOST_MACHINE
),armeb
)
176 unslung-kernel build-unslung-kernel
: unslung
/.configured bitbake
/.configured openembedded
/.configured
177 ( cd unslung
; ${MAKE} kernel
)
179 unslung-kernel build-unslung-kernel
:
182 .PHONY
: openslug-kernel build-openslug-kernel
183 ifneq ($(HOST_MACHINE
),armeb
)
184 openslug-kernel build-openslug-kernel
: openslug
/.configured bitbake
/.configured openembedded
/.configured
185 ( cd openslug
; ${MAKE} kernel
)
187 openslug-kernel build-openslug-kernel
:
190 .PHONY
: ucslugc-kernel build-ucslugc-kernel
191 ifneq ($(HOST_MACHINE
),armeb
)
192 ucslugc-kernel build-ucslugc-kernel
: ucslugc
/.configured bitbake
/.configured openembedded
/.configured
193 ( cd ucslugc
; ${MAKE} kernel
)
195 ucslugc-kernel build-ucslugc-kernel
:
198 .PHONY
: build-optware
199 build-optware
: build-optware-nslu2 build-optware-wl500g build-optware-ds101 build-optware-ds101g
201 .PHONY
: optware-nslu2 build-optware-nslu2
202 ifneq ($(HOST_MACHINE
),armeb
)
203 optware-nslu2 build-optware-nslu2
: optware
/nslu2
/.configured
204 ( cd optware
/nslu2
; ${MAKE} autoclean
; ${MAKE} )
206 ifeq ($(HOST_FIRMWARE
),Unslung
)
207 optware-nslu2 build-optware-nslu2
: optware
/nslu2
/.configured
208 ( cd optware
/nslu2
; ${MAKE} autoclean
; ${MAKE} )
210 optware-nslu2 build-optware-nslu2
:
214 .PHONY
: optware-wl500g build-optware-wl500g
215 ifneq ($(HOST_MACHINE
),armeb
)
216 optware-wl500g build-optware-wl500g
: optware
/wl500g
/.configured
217 ( cd optware
/wl500g
; ${MAKE} autoclean
; ${MAKE} )
219 optware-wl500g build-optware-wl500g
:
222 .PHONY
: optware-ds101 build-optware-ds101
223 ifneq ($(HOST_MACHINE
),armeb
)
224 optware-ds101 build-optware-ds101
: optware
/ds101
/.configured
225 ( cd optware
/ds101
; ${MAKE} autoclean
; ${MAKE} )
227 optware-ds101 build-optware-ds101
:
230 .PHONY
: optware-ds101g build-optware-ds101g
231 ifneq ($(HOST_MACHINE
),armeb
)
232 optware-ds101g build-optware-ds101g
: optware
/ds101g
/.configured
233 ( cd optware
/ds101g
; ${MAKE} autoclean
; ${MAKE} )
235 optware-ds101g build-optware-ds101g
:
238 openslug-
%-beta
: update-openslug-
%-beta build-openslug-
%-beta
241 build-openslug-2.3
-beta
: releases
/OpenSlug-2.3
-beta
/.configured
242 ( cd releases
/OpenSlug-2.3
-beta
; ${MAKE} openslug-firmware
)
244 build-openslug-
%-beta
: releases
/OpenSlug-
%-beta
/.configured
245 ( cd releases
/OpenSlug-
$*-beta
; ${MAKE} firmware
)
248 setup-master MT
/.configured
:
249 [ -e monotone
/nslu2-linux.db
] ||
( mkdir
-p monotone
&& \
250 wget http
://sources.nslu2-linux.org
/monotone
/nslu2-linux.db.gz
-O monotone
/nslu2-linux.db.gz
&& \
251 gunzip monotone
/nslu2-linux.db.gz
)
252 - ( monotone
-d monotone
/nslu2-linux.db unset database default-server
)
253 - ( monotone
-d monotone
/nslu2-linux.db unset database default-include-pattern
)
254 ( monotone
-d monotone
/nslu2-linux.db pull monotone.nslu2-linux.org org.
{nslu2-linux.
*,openembedded.dev
} )
255 [ -e MT
/revision
] ||
( monotone
-d monotone
/nslu2-linux.db
co -b org.nslu2-linux.dev .
)
258 .PHONY
: setup-bitbake
259 setup-bitbake bitbake
/.configured
: MT
/.configured
260 [ -e bitbake
/bin
/bitbake
] || monotone
co -b org.nslu2-linux.bitbake bitbake
261 touch bitbake
/.configured
263 .PHONY
: setup-openembedded
264 setup-openembedded openembedded
/.configured
: MT
/.configured
265 [ -e openembedded
/conf
/machine
/nslu2.conf
] || monotone
co -b org.openembedded.dev openembedded
266 touch openembedded
/.configured
268 .PHONY
: setup-optware
269 setup-optware optware
/.configured
: MT
/.configured
270 [ -e downloads
] ||
( mkdir
-p downloads
)
271 [ -e optware
/Makefile
] ||
( cvs
-q
-d
:pserver
:anonymous@cvs.sf.net
:/cvsroot
/nslu
co -d optware unslung
)
272 touch optware
/.configured
274 # This pattern rule has to come before the subsequent %/.configured openembedded pattern rule.
275 optware
/%/.configured
: optware
/.configured
276 [ -e optware
/$*/Makefile
] ||
( \
277 mkdir
-p optware
/$* ; \
278 echo
"OPTWARE_TARGET=$*" > optware
/$*/Makefile
; \
279 echo
"include ../Makefile" >> optware
/$*/Makefile
; \
280 ln
-s ..
/..
/downloads optware
/$*/downloads
; \
281 ln
-s ..
/make optware
/$*/make
; \
282 ln
-s ..
/scripts optware
/$*/scripts
; \
283 ln
-s ..
/sources optware
/$*/sources
; \
285 touch optware
/$*/.configured
287 .PHONY
: setup-optware-developer
288 setup-optware-developer
:
289 [ ! -e optware
] ||
( mv optware optware-user
)
290 cvs
-q
-d
:ext
:${CVS_USER}@cvs.sf.net
:/cvsroot
/nslu
co -d optware unslung
291 ${MAKE} setup-optware
293 .PHONY
: setup-unslung setup-openslug setup-ucslugc
294 setup-unslung setup-openslug setup-ucslugc
: setup-
%: MT
/.configured
295 rm -rf
$*/.configured
296 ${MAKE} $*/.configured
298 %/.configured
: MT
/.configured
299 [ -d
$* ] ||
( mkdir
-p
$* )
300 [ -e downloads
] ||
( mkdir
-p downloads
)
301 [ -L
$*/Makefile
-o
! -e
$*/Makefile
] ||
( cd
$* ; mv Makefile Makefile.delete-me
)
302 [ -e
$*/Makefile
] ||
( cd
$* ; ln
-s ..
/common
/openembedded.mk Makefile
)
303 [ -L
$*/setup-env
-o
! -e
$*/setup-env
] ||
( cd
$* ; mv setup-env setup-env.delete-me
)
304 [ -e
$*/setup-env
] ||
( cd
$* ; ln
-s ..
/common
/setup-env .
)
305 [ -e
$*/downloads
] ||
( cd
$* ; ln
-s ..
/downloads .
)
306 [ -e
$*/bitbake
] ||
( cd
$* ; ln
-s ..
/bitbake .
)
307 [ -e
$*/openembedded
] ||
( cd
$* ; ln
-s ..
/openembedded .
)
308 [ -d
$*/conf
] ||
( mkdir
-p
$*/conf
)
309 [ ! -f
$*/conf
/local.conf
-o
-e
$*/conf
/auto.conf
] ||
( cd
$*/conf
; mv local.conf local.conf.delete-me
)
310 [ -e
$*/conf
/local.conf.sample
] ||
( cd
$*/conf
; ln
-s ..
/..
/common
/conf
/local.conf.sample .
)
311 [ -e
$*/conf
/site.conf
] ||
( cd
$*/conf
; ln
-s ..
/..
/common
/conf
/site.conf .
)
312 [ ! -f
$*/conf
/auto.conf
] ||
( cd
$*/conf
; rm -f auto.conf
)
313 [ -e
$*/conf
/auto.conf
] ||
( \
314 if
[ "${HOST_MACHINE}" = "armeb" ] ; then \
315 echo
"DISTRO=\"$*-native\"" > $*/conf
/auto.conf
; \
317 echo
"DISTRO=\"$*\"" > $*/conf
/auto.conf
; \
319 echo
"MACHINE=\"nslu2\"" >> $*/conf
/auto.conf \
324 .PHONY
: setup-slugimage-developer
325 setup-slugimage-developer
:
326 cvs
-q
-d
:ext
:${CVS_USER}@cvs.sf.net
:/cvsroot
/nslu
co slugimage
328 .PHONY
: setup-upslug-developer
329 setup-upslug-developer
:
330 cvs
-q
-d
:ext
:${CVS_USER}@cvs.sf.net
:/cvsroot
/nslu
co upslug
332 .PHONY
: setup-sluggo-developer
333 setup-sluggo-developer
:
334 cvs
-q
-d
:ext
:${CVS_USER}@cvs.sf.net
:/cvsroot
/nslu
co sluggo
337 setup-apex apex
/Makefile
:
338 cvs
-q
-d
:pserver
:anonymous@cvs.sf.net
:/cvsroot
/nslu
co apex
340 .PHONY
: setup-apex-developer
341 setup-apex-developer
:
342 cvs
-q
-d
:ext
:${CVS_USER}@cvs.sf.net
:/cvsroot
/nslu
co apex
344 setup-openslug-2.3
-beta releases
/OpenSlug-2.3
-beta
/.configured
:
345 [ -e releases
/OpenSlug-2.3
-beta
] ||
( \
346 mkdir
-p releases
; \
347 svn checkout svn
://svn.berlios.de
/openslug
/releases
/OpenSlug-2.3
-beta \
348 releases
/OpenSlug-2.3
-beta \
350 ( cd releases
/OpenSlug-2.3
-beta
; ${MAKE} conf
/local.conf setup-env
)
351 [ -e downloads
] ||
( mkdir
-p downloads
)
352 [ -e releases
/OpenSlug-2.3
-beta
/downloads
] || ln
-s ..
/..
/downloads releases
/OpenSlug-2.3
-beta
/
353 touch releases
/OpenSlug-2.3
-beta
/.configured
355 setup-openslug-
%-beta releases
/OpenSlug-
%-beta
/.configured
:
356 [ -e releases
/OpenSlug-
$*-beta
] ||
( \
357 mkdir
-p releases
; \
358 svn checkout svn
://svn.berlios.de
/openslug
/releases
/OpenSlug-
$*-beta \
359 releases
/OpenSlug-
$*-beta \
361 ( cd releases
/OpenSlug-
$*-beta
; ${MAKE} setup-env
)
362 [ -e downloads
] ||
( mkdir
-p downloads
)
363 [ -e releases
/OpenSlug-
$*-beta
/downloads
] || ln
-s ..
/..
/downloads releases
/OpenSlug-
$*-beta
/
364 touch releases
/OpenSlug-
$*-beta
/.configured
366 setup-openslug-
%-beta-developer
:
367 [ -e releases
/OpenSlug-
$*-beta
] ||
( \
368 mkdir
-p releases
; \
369 svn checkout svn
+ssh
://svn.berlios.de
/svnroot
/repos
/openslug
/releases
/OpenSlug-
$*-beta \
370 releases
/OpenSlug-
$*-beta \
372 ${MAKE} setup-openslug-
$*-beta
374 .PHONY
: setup-host-debian
378 autoconf automake automake1.9 \
384 g++ gawk gcj gettext \
385 libc6-dev libglib2.0-dev libtool \
388 python python-dev python-psyco python2.4 python2.4-dev \
394 echo You will have to install monotone separately. See http://venge.net/monotone/ \
397 .PHONY
: setup-host-ubuntu
401 autoconf automake automake1.9 \
407 gcc g++ gawk gcj gettext \
408 libc6-dev libglib2.0-dev libtool \
411 python python-dev python2.4 python2.4-dev \
418 echo You will have to install monotone separately. See http://venge.net/monotone/ \
419 echo To get python2.4-psyco (Recommended to speed up builds), please read \
420 echo http://ubuntuguide.org/#extrarepositories \
424 .PHONY
: setup-host-gentoo
426 su
- -c
"mkdir -p /etc/portage ; echo >> /etc/portage/package.keywords ; \
427 grep monotone-0.22 /etc/portage/package.keywords || \
428 echo ~dev-util/monotone-0.22 ~* >> /etc/portage/package.keywords ; \
429 grep dev-libs/boost-1.32.0 /etc/portage/package.keywords || \
430 echo ~dev-libs/boost-1.32.0 ~* >> /etc/portage/package.keywords ; \
451 .PHONY
: update-master
452 update-master
: MT
/.configured
453 # if [ `monotone -d monotone/nslu2-linux.db list keys nslu2-linux@nslu2-linux.org | wc -l` = 8 ] ; then \
454 # monotone -d monotone/nslu2-linux.db dropkey nslu2-linux@nslu2-linux.org ; \
457 if
[ `monotone automate heads org.nslu2-linux.dev | wc -l` != "1" ] ; then \
458 monotone merge
-b org.nslu2-linux.dev
; \
461 if
[ `monotone automate heads org.nslu2-linux.dev | wc -l` != "1" ] ; then \
462 monotone merge
-b org.nslu2-linux.dev
; \
465 .PHONY
: update-bitbake
466 update-bitbake
: bitbake
/.configured
468 if
[ `monotone automate heads org.nslu2-linux.bitbake | wc -l` != "1" ] ; then \
469 monotone merge
-b org.nslu2-linux.bitbake
; \
471 ( cd bitbake
; monotone update
)
472 if
[ `monotone automate heads org.nslu2-linux.bitbake | wc -l` != "1" ] ; then \
473 monotone merge
-b org.nslu2-linux.bitbake
; \
476 .PHONY
: update-openembedded
477 update-openembedded
: openembedded
/.configured
478 if grep
"org.openembedded.nslu2-linux" openembedded
/MT
/options
>/dev
/null
2>&1 ; then \
479 sed
-i
-e
's/org.openembedded.nslu2-linux/org.openembedded.dev/' openembedded
/MT
/options
; \
480 monotone propagate org.openembedded.nslu2-linux org.openembedded.dev
; \
483 if
[ `monotone automate heads org.openembedded.dev | wc -l` != "1" ] ; then \
484 monotone merge
-b org.openembedded.dev
; \
486 ( cd openembedded
; monotone update
)
487 if
[ `monotone automate heads org.openembedded.dev | wc -l` != "1" ] ; then \
488 monotone merge
-b org.openembedded.dev
; \
491 .PHONY
: update-optware
492 update-optware
: optware
/.configured
493 ( cd optware
; cvs
-q update
-d
-P
)
495 update-openslug-
%-beta
: releases
/OpenSlug-
%-beta
/.configured
496 ( cd releases
/OpenSlug-
$*-beta
; svn up
)
498 .PHONY
: status-master
499 status-master
: MT
/.configured
500 monotone status
--brief
502 .PHONY
: status-bitbake
503 status-bitbake
: bitbake
/.configured
504 ( cd bitbake
; monotone status
--brief
)
506 .PHONY
: status-openembedded
507 status-openembedded
: openembedded
/.configured
508 ( cd openembedded
; monotone status
--brief
)
510 .PHONY
: status-optware
511 status-optware
: optware
/.configured
512 ( cd optware
; cvs
-q update
-d
-P
)
514 status-openslug-
%-beta
:
515 ( cd releases
/OpenSlug-
$*-beta
; svn status
)
517 .PHONY
: clobber-unslung
519 [ ! -e unslung
/Makefile
] ||
( cd unslung
; ${MAKE} clobber )
521 .PHONY
: clobber-openslug
523 [ ! -e openslug
/Makefile
] ||
( cd openslug
; ${MAKE} clobber )
525 .PHONY
: clobber-ucslugc
527 [ ! -e ucslugc
/Makefile
] ||
( cd ucslugc
; ${MAKE} clobber )
529 .PHONY
: clobber-optware
530 clobber-optware
: clobber-optware-nslu2 clobber-optware-wl500g clobber-optware-ds101 clobber-optware-ds101g
532 .PHONY
: clobber-optware-
%
534 [ ! -e optware
/$*/Makefile
] ||
( cd optware
/$* ; ${MAKE} distclean )
536 .PHONY
: distclean-master
538 rm -rf MT common downloads openslug scripts ucslugc unslung
540 .PHONY
: distclean-bitbake
544 .PHONY
: distclean-openembedded
545 distclean-openembedded
:
548 .PHONY
: distclean-unslung
552 .PHONY
: distclean-openslug
556 .PHONY
: distclean-ucslugc
560 .PHONY
: distclean-optware
564 .PHONY
: distclean-releases
568 # Targets for use by those with write access to the repositories
571 push
: push-master push-bitbake push-openembedded
574 push-master
: update-master
578 push-bitbake
: update-bitbake
579 ( cd bitbake
; monotone push
)
581 .PHONY
: push-openembedded
582 push-openembedded
: update-openembedded
583 ( cd openembedded
; monotone push
)
585 # Targets for use by core team members only
587 .PHONY
: import-bitbake
588 import-bitbake
: bitbake
/.configured
589 mv bitbake bitbake.old
590 svn
co svn
://svn.berlios.de
/bitbake
/trunk
/bitbake
591 cp
-rp bitbake.old
/MT bitbake.old
/.mt-attrs bitbake
593 ( cd bitbake
; rm -rf .svn
; monotone status
)