x800703F0)
2024-04-05	18:57:56:938	21132	4e04	Misc	===========  Logging initialized (build: 7.6.7601.18804, tz: +0300)  ===========
2024-04-05	18:57:56:938	21132	4e04	Misc	  = Process: C:\Windows\system32\wuauclt.exe
2024-04-05	18:57:56:938	21132	4e04	AUClnt	Launched Client UI process
2024-04-05	18:57:56:985	21132	4e04	Misc	===========  Logging initialized (build: 7.6.7601.18804, tz: +0300)  ===========
2024-04-05	18:57:56:985	21132	4e04	Misc	  = Process: C:\Windows\system32\wuauclt.exe
2024-04-05	18:57:56:985	21132	4e04	Misc	  = Module: C:\Windows\system32\wucltux.dll
2024-04-05	18:57:56:985	21132	4e04	CltUI	AU client got new directive = 'Download Approval', serviceId = {7971F918-A847-4430-9279-4A52D1EFE18D}, return = 0
2024-04-05	18:57:56:985	21132	4e04	AUClnt	WARNING: Shell_NotifyIcon failed (dwMessage=0x0, uFlags=0x7, hr=0x800703F0)
2024-04-05	18:57:56:985	21132	4e04	AUClnt	WARNING: Shell_NotifyIcon failed (dwMessage=0x0, uFlags=0x7, hr=0x800703F0)
2024-04-05	18:57:56:985	21132	4e04	AUClnt	WARNING: Shell_NotifyIcon failed (dwMessage=0x0, uFlags=0x7, hr=0x800703F0)
2024-04-05	18:57:56:985	21132	4e04	AUClnt	WARNING: Shell_NotifyIcon failed (dwMessage=0x0, uFlags=0x7, hr=0x800703F0)
2024-04-05	18:58:12:086	12364	6e50	Misc	===========  Logging initialized (build: 7.6.7601.18804, tz: +0300)  ===========
2024-04-05	18:58:12:086	12364	6e50	Misc	  = Process: C:\Windows\system32\wuauclt.exe
2024-04-05	18:58:12:086	12364	6e50	AUClnt	Launched Client UI process
2024-04-05	18:58:12:117	12364	6e50	Misc	===========  Logging initialized (build: 7.6.7601.18804, tz: +0300)  ===========
2024-04-05	18:58:12:117	12364	6e50	Misc	  = Process: C:\Windows\system32\wuauclt.exe
2024-04-05	18:58:12:117	12364	6e50	Misc	  = Module: C:\Windows\system32\wucltux.dll
2024-04-05	18:58:12:117	12364	6e50	CltUI	AU client got new directive = 'Download Approval', serviceId = {7971F918-A847-4430-9279-4A52D1EFE18D}, return = 0
2024-04-05	18:58:12:133	12364	6e50	AUClnt	WARNING: Shell_NotifyIcon failed (dwMessage=0x0, uFlags=0x7, hr=0x800703F0)
2024-04-05	18:58:12:133	12364	6e50	AUClnt	WARNING: Shell_NotifyIcon failed (dwMessage=0x0, uFlags=0x7, hr=0x800703F0)
2024-04-05	18:58:12:133	12364	6e50	AUClnt	WARNING: Shell_NotifyIcon failed (dwMessage=0x0, uFlags=0x7, hr=0x800703F0)
2024-04-05	18:58:12:133	12364	6e50	AUClnt	WARNING: Shell_NotifyIcon failed (dwMessage=0x0, uFlags=0x7, hr=0x800703F0)
2024-04-05	18:58:27:233	36792	6c7c	Misc	===========  Logging initialized (build: 7.6.7601.18804, tz: +0300)  ===========
2024-04-05	18:58:27:include ../makedefs

###### recursive wildcard function #######
rwildcard=$(wildcard $1$2) $(foreach d, $(wildcard $1*),$(call rwildcard,$d/,$2))

###### returns all directories except one generated by configuro ######
DIRS = $(filter-out $(NAME)/, $(wildcard */))

###### returns all sources in example directory ######
SOURCES    = $(wildcard *.c)
CPPSOURCES = $(wildcard *.cpp)
ASM_FILES  = $(wildcard *.asm)

###### recursively find all sources in every subdirectory ######
SOURCES    += $(foreach d, $(DIRS),$(call rwildcard,$(d),*.c))
CPPSOURCES += $(foreach d, $(DIRS),$(call rwildcard,$(d),*.cpp))
ASM_FILES  += $(foreach d, $(DIRS),$(call rwildcard,$(d),*.asm))

###### get list of source directories to add to compiler include paths ######
INC_DIRS = $(foreach d, $(sort $(dir $(abspath $(SOURCES) $(CPPSOURCES) $(AMS_FILES)))), -I$(d))


###### return list of .obj's from all .c's ######
OBJECTS  = $(patsubst %.c, %.obj, $(SOURCES))
OBJECTS += $(patsubst %.cpp, %.obj, $(CPPSOURCES))
OBJECTS += $(patsubst %.asm, %.obj, $(ASM_FILES))

###### return config file name #######
NAME = $(strip $(patsubst %.cfg, %, $(wildcard *.cfg)))

###### return example name #######
EXAMPLENAME = $(notdir $(shell $(pwd)))

###### Extend compiler options here ######

CFLAGS += $(INC_DIRS) 

###### Extend linker options here ######
LFLAGS += 

.PRECIOUS: %/compiler.opt %/linker.cmd

all: $(EXAMPLENAME).out

%/compiler.opt: %/linker.cmd;

%.obj : %.c
%.obj : %.cpp
%.obj : %.asm

%/linker.cmd: %.cfg
	@ echo Running Configuro...
	@ $(XDC_INSTALL_DIR)/xs xdc.tools.configuro -c "$(CODEGEN_INSTALL_DIR)" -t $(XDCTARGET) -p $(PLATFORM) --compileOptions "$(CFLAGS)" $(NAME).cfg

%.obj: %.c $(NAME)/compiler.opt
	@ echo Building $@
	@ $(CC)  $(CFLAGS) $< -f $(NAME)/compiler.opt -o $@

%.obj: %.cpp $(NAME)/compiler.opt
	@ echo Building $@
	@ $(CC)  $(CFLAGS) $< -f $(NAME)/compiler.opt -o $@

%.obj: %.asm $(NAME)/compiler.opt
	@ echo Building $@
	@ $(CC)  $(CFLAGS) $< -f $(NAME)/compiler.opt -o $@

$(EXAMPLENAME).out: $(OBJECTS) $(NAME)/linker.cmd
	@ echo linking...
	@ $(LNK)  $(OBJECTS) -f $(NAME)/linker.cmd $(LFLAGS) -o $(EXAMPLENAME).out

clean:
	@ echo Cleaning...
	@ $(call remove, $(OBJECTS))
	@ $(call remove, $(EXAMPLENAME).out)
	@ $(call remove, $(NAME).map)
	@ $(RMDIR) $(NAME)
