BSDBuild Logo

How portable is BSDBuild?
BSDBuild is portable to many operating systems including most flavors of Unix, MacOS and Windows. It requires a standard make utility (such as GNU make or BSD make), a Bourne shell and the commands test, echo and sed. See the Portability page for more details.
Which languages are supported?
At this time, executables and libraries can be compiled from sources in Ada, C, C++, Objective C, assembler, Lex and Yacc. Adding support for new languages can be done easily.

The language of a source file in ${SRCS} is determined by its file extension. Refer to the current and manual pages for the complete list.
Is cross-compilation supported?
Yes, you can pass --host to any BSDBuild ./configure script and it will arrange for cross-compilation to the given target. BSDBuild also provides special support for the cc65 compiler to 65(C)02 based platforms and emscripten for compiling to WebAssembly.
Do you have a template for a BSDBuild project?

The following should allow you to compile a "Hello world" program in C.

First, create a directory for the project and use the mkify prog command to create a copy of the files required by the module:

  $ mkdir hello
  $ cd hello
  $ mkify prog
  Installing in mk: ...
  Installing scripts: ...

mkify should create a subdirectory mk and an empty Makefile. Open up the Makefile in an editor and add the directives:

  PROG= hello
  SRCS= hello.c
  include ${TOP}/mk/

A minimal hello.c might look like:

  #include <stdio.h>
  main(int argc, char *argv[])
      printf("Hello, world!\n");
      return (0);

Now you can run make depend for the first time to generate dependencies:

  $ touch .depend
  $ make depend

Finally, compile the program with make:

  $ make
  cc -O2 -pipe   -o hello.o -c hello.c

  $ ./hello
  Hello, world!

Next, you might want to add a configure script. Create a file called with the following:

# Example BSDBuild configure script
# ex: syn=bsdbuild


register("--some-option", "An example option")
register("--enable-warnings", "Enable compiler warnings")


if [ "${enable_warnings}" = "yes" ]; then

To compile to a POSIX-style configure script, use the mkconfigure command:

  $ cat | mkconfigure > configure
  $ chmod 755 configure
How do I produce a single library from source files located in different subdirectories?

You can create a standard makefile and use relative path names in ${SRCS}, for example:

  TOP=	.
  LIB=	mylib
  SRCS=	source1.c \
        subdir1/source2.c \
  include ${TOP}/Makefile.config
  include ${TOP}/mk/
Can I create a Makefile in a directory without any sources?

Yes, by including only, and setting the targets explicitely:

  TOP=	.
  SUBDIR= dir1 \
  all: all-subdir
  install: install-subdir
  deinstall: deinstall-subdir
  clean: clean-subdir
  cleandir: cleandir-subdir
  depend: depend-subdir
  include ${TOP}/mk/
Is profiling supported?

Yes, you can set ${GMONOUT} to the desired output filename and then invoke:

  $ make ${GMONOUT}
What is a good ".gitignore" file for a project that uses BSDBuild?

To ignore files generated by make depend and configure:


# If configure uses c_incdir():

# If configure uses config_script():

# If configure uses pkgconfig_mod():

*.rej ElectronTubeStore