Erika Makefiles
From ErikaWiki
Please notice that this page is still incomplete, and some important information is missing. Feel free to add it :-)
Contents |
Variables used in the makefiles
- ERIKA_FILES
- root of Erika source tree written using the host-OS path style (e.g.,
C:\Erika
on Windows,/opt/Erika
on Linux). It must not be used within makefiles; it is used to initializeEEBASE
inside the makefile generated by RT-Druid. - EEBASE
- root of the Erika source tree, used inside makefiles. It must be a path with no spaces (or everything breaks). It is used by make with no translation, therefore it must follow the style of the toolchain (e.g., Cygwin and Linux require Unix-style paths).
- PKGBASE
- set to
$(EEBASE)/pkg
- ALLINCPATH
- Options for the include options (not just the include paths). Set by
pkg/cfg/arc/cc_###.mk
,pkg/cfg/arc/rules_###.mk
, andcontrib/.../libcfg.mk
. Do not use this on new architectures; useINCLUDE_PATH
instead. - INCLUDE_PATH
- List of include paths, spelled with unix-style slash a no spaces. Used on some architectures, it should replace
ALLINCPATH
on all architectures in the near future. - APP_SRCS
- application source files
- SRCS
- all source files to compile (excluding library source files)
- OBJS
- objects to build the final executable (paths are relative to the building directory)
- LIBEESRCS
- Erika source files to compile (paths are relative to
$(EEBASE)
) - LIBEEOBJS
- Erika objects (paths relative to the building directory)
- OUTPUT_DIR
- where executables are created
- OBJDIR
- root of the directory tree where objects are created
- TARGET
- the ultimate product of the building rules; a binary executable/object or the disassembly of it
- LIBDEP
- libraries to depend on (Erika included)
- OPT_LIBS
- options to link libraries (Erika included)
Makefiles
- $(OUTPUT_DIR)/makefile
- This makefile is generated by RT-Druid from the Oil file. It sets
EEOPT
,APP_SRCS
, and other variables. It includes$(EEBASE)/pkg/cfg/rules.mk
. - $(EEBASE)/pkg/cfg/rules.mk
- It includes app.mk (if it exists). It fixes
EEOPT
by adding options needed by current options and includes architecture-specific filespkg/cfg/arch/rules_###.mk
- $(EEBASE)/pkg/cfg/arch/rules_###.mk
- It includes
$(EEBASE)/pkg/cfg/dir.mk
,$(PKGBASE)/cfg/verbose.mk
,$(PKGBASE)/cfg/compiler.mk
,$(PKGBASE)/cfg/cfg.mk
. This is the main makefile, which contains all compilation rules (all
,clean
,%o:%.c
...) - $(EEBASE)/pkg/cfg/dir.mk
- Some path variables. Notably,
PKGBASE
is defined here. - $(PKGBASE)/cfg/verbose.mk
- Rules to print lines
DEP
,CC
... - $(PKGBASE)/cfg/compiler.mk
- It includes compiler-specific stuff from
pkg/cfg/arch/cc_###.mk
. - $(EEBASE)/pkg/cfg/arch/cc_###.mk
- Definitions of compiler variables: tool executables and options.
- $(PKGBASE)/cfg/cfg.mk
- It includes
$(EEBASE)/pkg/*/*/cfg/cfg.mk
,$(EEBASE)/contrib/*/cfg/libcfg.mk
,$(EEBASE)/contrib/*/cfg/contrib.mk
, and$(EEBASE)/contrib/*/cfg/cfg.mk
. - $(EEBASE)/pkg/.../cfg/cfg.mk
- These makefiles add source files to
EE_SRCS
, depending on the options inEEOPT
.
Important Functions
- iseeopt
- Used to test
EEOPT
s defined in the OIL file or generated by RT-Druid. This function hides the internal representations ofEEOPT
s, and can be used in conditionals and in OR/AND expressions. Examples:
ifeq ($(call iseeopt,__MULTI__), yes) # if __MULTI__ is set endif ifeq ($(and $(call iseeopt,__MULTI__), $(call iseeopt,__IRQ_STACK_NEEDED__)), yes) # if both __MULTI__ and __IRQ_STACK_NEEDED__ are set endif ifneq ($(call iseeopt,__MULTI__), yes) # if __MULTI__ is not set endif
- native_path
- Defined in
$(EEBASE)/pkg/cfg/rules.mk
. It converts a file (or directory) path written in Unix style into the native format. It used to hide and abstract path handling, so that it is possible to write rules that work regardless of the host operating system. It takes one argument, the path to convert. Example:
%.o: %.c @$(CC) $(call native_path,$<) -o $(call native_path,$@)
- Always prefer native-path to calling cygpath directly.