The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

Sample code: make everything

Contributed by: Nate LaCourse
This tip is valid for: Both BeOS and Haiku

One of the long-lasting traditions with every successive release of the BeOS is the sample code archive (/boot/optional/sample-code). It’s a collection of feature-light, but nevertheless useful programs and pieces of code that developers are free to learn from, or to incorporate into their applications.

Note that if you’re using BeOS Personal Edition, you’ll need to download the sample code separately.

New in R5 Pro’s sample-code archive is the ability to compile all of the individual sample-code projects at once. To compile everything at once, fire up a Terminal and issue the following command (all on one line):

/bin/sh -c “cd /boot/optional/sample-code ; cp makefile.all makefile ; make ; rm makefile”

Let it grind for a while, and voila! You’ve now compiled every individual project. To make everything on a version of BeOS older than R5, you can simply create a text file called ‘makefile’ in /boot/optional/sample-code, containing the following:

SUBDIRS =
	folder1
	folder2
	folder3
	folder4
default .DEFAULT :
	-@for f in $(SUBDIRS) ; do
		$(MAKE) -C $$f -f makefile.all $@;
	done

Where folder1 is the name of the first folder that contains sample- code projects, folder2 the second, and so on… After you’ve done this, simply type the following into a Terminal to compile everything:

/bin/sh -c "cd /boot/optional/sample-code ; make"

Posted in Miscellaneous


(comments are closed).