Erika Makefiles

From ErikaWiki

(Difference between revisions)
Jump to: navigation, search
(Important Functions)
(Variables used in the makefiles)
Line 7: Line 7:
: set to <code>$(EEBASE)/pkg</code>
: set to <code>$(EEBASE)/pkg</code>
;ALLINCPATH
;ALLINCPATH
-
: Options for the include options (not just the include paths).  Set by <code>pkg/cfg/arc/cc_###.mk</code>, <code>pkg/cfg/arc/rules_###.mk</code>, and <code>contrib/.../libcfg.mk</code>.  Do not use this on new architectures.
+
: Options for the include options (not just the include paths).  Set by <code>pkg/cfg/arc/cc_###.mk</code>, <code>pkg/cfg/arc/rules_###.mk</code>, and <code>contrib/.../libcfg.mk</code>.  Do not use this on new architectures; use <code>INCLUDE_PATH</code> instead.
;INCLUDE_PATH
;INCLUDE_PATH
-
: List of include paths, spelled with unix-style slash.  Used on some architectures, it should replace ALLINCPATH on all architectures in the near future.
+
: List of include paths, spelled with unix-style slash.  Used on some architectures, it should replace <code>ALLINCPATH</code> on all architectures in the near future.
;APP_SRCS
;APP_SRCS
: application source files
: application source files

Revision as of 11:24, 17 September 2011

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

EEBASE
root of the Erika source tree
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, and contrib/.../libcfg.mk. Do not use this on new architectures; use INCLUDE_PATH instead.
INCLUDE_PATH
List of include paths, spelled with unix-style slash. 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 files pkg/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 in EEOPT.

Important Functions

iseeopt
Used to test EEOPTs defined in the OIL file or generated by RT-Druid. This function hides the internal representations of EEOPTs, 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.

See Also

Personal tools