SDK: Project makefiles - fvdhoef/aquarius-plus GitHub Wiki

A Makefile is a file used by the program make to build your project. It contains rules how to get from source code to resulting binary files.

Most example projects in the SDK have a very simple Makefile, similar to:

OUTFILE      = hello.caq
INC_DIRS    += .
SRC_DIRS    += .

include $(AQPLUS_SDK)/c/lib/Makefile.common

The Makefile can be so simple because it includes a common Makefile that is part of the Aquarius+ SDK, which contain the actual rules.

There are a few variables that are important in your project's Makefile:

Name Description
OUTFILE Name of executable generated by building your project.
INC_DIRS Directories to scan for include files.
SRC_DIRS Directories to scan for source files, both C files (.c extension) and assembly files (.s extension).
FILES_TO_COPY Files to copy to the emulator or real Aquarius+ when running the program via make run_emu or make run_aqp. By default this includes OUTFILE. You can use this if you for instance want to also copy assets (e.g. graphics or music) when running your program.
S_SRCS (advanced) Assembly files to assemble. Derived from SRC_DIRS, but you can also manually add individual files to this variable.
C_SRCS (advanced) C files to compile. Derived from SRC_DIRS, but you can also manually add individual files to this variable.
CFLAGS (advanced) Flags to pass to the assembler.
LFLAGS (advanced) Flags to pass to the linker.
DEPS (advanced) Additional dependencies when building. Useful if you want to convert some assets during the build process.
AQPLUS_SDK (Usually set via an environment variable.) Location of the SDK.
AQPLUS_HOST (Usually set via an environment variable.) Hostname of the real Aquarius+ to connect to when running the make run_aqp command.
AQPLUS_EMU (Usually set via an environment variable.) Command to start the emulator.
AQPLUS_EMU_DISK (Usually set via an environment variable.) Location of the folder used by the emulator as SD card. Used for FILES_TO_COPY.

The name (or names) specified after the make command is called a target. The supported targets are:

Name Description
all Build all files
clean Clean the project directory by removing the build directory.
run_emu Build and run your project on the emulator
run_aqp Build and run your project on a real Aquarius+. This will first upload the files in FILES_TO_COPY to your Aquarius+ and then reset and start your program on the Aquarius+ by emulating keyboard presses.

For extensive information on make, look at the official documentation (this can be overwhelming for the newcomer) at https://www.gnu.org/software/make/manual/make.html.