1 ### Makefile to build the FreeRTOS library ###
\r
3 # Build target (options: sim, board)
\r
13 XT_CORE = $(patsubst %-params,%,$(notdir $(shell xt-xcc --show-config=core)))
\r
14 CONFIGDIR = $(shell xt-xcc --show-config=config)
\r
16 # For platform-specific commands
\r
18 include $(CONFIGDIR)/misc/hostenv.mk
\r
20 # Source code and build locations
\r
22 SRCROOT = $(subst /,$(S),$(CURDIR))
\r
23 TSTROOT = $(abspath $(SRCROOT)$(S)..$(S)..$(S)..$(S)..$(S)..$(S)demos$(S)cadence$(S)sim$(SMALL))
\r
24 BLDROOT = $(TSTROOT)$(S)build
\r
25 BLDDIR = $(BLDROOT)$(S)$(XT_CORE)
\r
27 FR_SRCDIR = $(abspath $(SRCROOT)$(S)..$(S)..$(S)..)
\r
28 FR_SRCDIR2 = $(FR_SRCDIR)$(S)portable$(S)MemMang
\r
29 XT_SRCDIR = $(SRCROOT)
\r
31 vpath %.c $(FR_SRCDIR) $(FR_SRCDIR2) $(XT_SRCDIR)
\r
32 vpath %.S $(XT_SRCDIR)
\r
36 FR_C_FILES = $(notdir $(wildcard $(FR_SRCDIR)/*.c)) $(notdir $(wildcard $(FR_SRCDIR2)/*.c))
\r
37 XT_C_FILES = $(notdir $(wildcard $(XT_SRCDIR)/*.c))
\r
38 XT_S_FILES = $(notdir $(wildcard $(XT_SRCDIR)/*.S))
\r
40 # List of all .o files that will go into the library
\r
42 LIB_C_O = $(patsubst %.c,%.o,$(XT_C_FILES) $(FR_C_FILES))
\r
43 LIB_S_O = $(patsubst %.S,%.o,$(XT_S_FILES))
\r
44 LIB_O_LIST = $(addprefix $(BLDDIR)/,$(LIB_C_O) $(LIB_S_O))
\r
48 OSLIB = $(BLDDIR)$(S)libfreertos.a
\r
52 ifeq ($(TARGET),sim)
\r
53 DFLAGS = -DXT_SIMULATOR
\r
55 ifeq ($(TARGET),board)
\r
60 -I$(FR_SRCDIR)$(S)..$(S)include -I$(FR_SRCDIR)$(S)..$(S)include$(S)private \
\r
61 -I$(XT_SRCDIR) -I$(TSTROOT)$(S)common$(S)config_files -I$(BLDDIR)
\r
64 CCFLAGS = $(CFLAGS) -Wall -mno-coproc -mlongcalls -ffunction-sections -mno-l32r-flix $(DFLAGS)
\r
65 ASFLAGS = $(CCFLAGS)
\r
67 # Include dependency rules (generated using -MD)
\r
69 -include $(wildcard $(BLDDIR)/*.d)
\r
73 all : mkdir $(OSLIB)
\r
75 mkdir : $(BLDDIR)/.mkdir
\r
78 @$(MKPATH) $(BLDDIR)
\r
80 -$(CP) $(CONFIGDIR)/xtensa-elf/include/sys/reent.h $(BLDDIR)/reent.h
\r
82 $(OSLIB) : $(LIB_O_LIST)
\r
86 $(CC) $(CCFLAGS) $(IFLAGS) -MD -MF $(subst .o,.d,$@) -c -o $@ $<
\r
89 $(CC) $(ASFLAGS) $(IFLAGS) -MD -MF $(subst .o,.d,$@) -c -o $@ $<
\r
97 .PHONY : all mkdir clean clean_all
\r