Table of Contents

KempoMake : Adding Support

How to add support for a new OS

If you will be adding support for a particular platform, please talk to me first, so it's clear we have the same goals.

When adding additional platforms, please use a simple naming convention…

Os or Os-HB

Os Stands for Operating System, although this could be the Platform, or some other identifier if necessary.

HB Stands for “Home Brew”, please use that if you're targeting a platform that uses only home grown based tools. This is to differentiate from official devkits.

I'm not sure which way I'll go with Acronyms… does it make more sense to go with “GameCube-HB”, “GC-HB”, “GCube-HB” or “Dolphin-HB”? “NES-HB” is much preferred to “NintendoEntertainmentSystem-HB”, but what about “DS-HB”, “DC-HB”, etc? Somehow we'd need some level of obviousness for someone who say, doesn't own every system, but might be interested in building for a new one.

There also might be some differentiation of outputted binaries on some platforms depending on boot method. I hope that doesn't come up much though.

All of this said, although this system can be used for any target platform, I'm still almost solely interested in game consoles, set-top boxes, retro machines, and so on. I'm not horribly interested in 20 flavors of Linux on a PC for instance… but let's get some GCC toolchains for some obscure platforms going, and you'll have my interest.

Examples

(Note: None of these are actually supported targets, you're welcome to add them though.)

You'll need to make a few .mk files in your Os directory:

Build Levels Explained

There are three “build levels”, as follows; to add a platform to the project you must respect them:

The idea with the build levels is simply this:

I will make an exception to DEBUG, however, if binaries generated are too big to actually debug with a debugger, then you may add optimizations as long as the code is still traceable.

Compiler/Language Setup

You can use the Linux version of platform-rules.mk if you're basing a particular platform on a GCC toolchain. The following covers only this particular setup.

When using C and C++, KempoMake is going to assume that we're using a GCC compatible compiler. We use this, for instance, to compile c code(we use an identical line for c++):

$(CC) -c $< -o $@ -MD $(CCALLFLAGS)

Where -c blah.c compiles the file “blah.c”, -o blah.o outputs “blah.o”

(”-MD” is the flag that tells the compiler to make dependancies.)

So if your target compile doesn't use -c for source file, -o for output file, and -MD for dependancy generaton, it would be best to make CC/CPLUSPLUS point to a script that can parse the command line before passing it to the compiler. This should give the best compatibility.

As far as new source languages are concerned, its pretty much open, as long as you keep the majority of the flags within platform-flags-$(BUILD).mk. Keep in mind that any “app” variables you add to platform-apps.mk should ripple out to *all* platform-apps.mk files, either as empty entries or as new entries. As well you'll need to update the comments in each file to keep everything synchronized.

All languages are assumed to be able to take a source file and turn it into an object file that can be linked into a library/application. Therefore in a list of objects in a makefile:

OBJS = a.o b.o c.o d.o

All of these objects could potentially refer to four different languages; a.o could refer to a.cpp, b.o could refer to b.c, c.o could refer to c.vcl, and d.o could refer to d.vsm. The make system is smart enough so that it will look for the source files within the source trees you provide for your application.

New language support should generate at the very least, one default dependancy. Currently this is what .vsm and .vcl support does, and it looks like the following:

@$(ECHO) $@: $< > $*.$(DEP)