I've been using the C++ Advanced project to manage my builds. What I've found usefull is to allow the IDE to manage the syslib and use an advanced C++ Project project to build the application.
Once you make the decision to manage you own application makefiles I think you have 2 paths you can take.
- you can create your own makefiles from scratch and have them reference the syslib and build the elf and whatever other output you need. Requires understanding the output in detail.
- OR you can create an IDE managed project that uses the target syslib and then take the makefile from the application Debug or Release directory and copy it to your advanced C++ project. Then start hacking it up as needed. You can still use the underlying rules files provided by Altera to build the elf etc but you can add in you own code as well. This requires less knowledge of the tool chain.
I've taken the second approach and it's worked pretty well. We have an extensive library of existing code with makefiles that I just wanted to link in and so this give me the control I want. I just added a rule to the app makefile saying the the elf was dependent on my library and how to build it. Pretty straight forward. I used the LDDEPS macro to add my dependency to the elf like this:# LDDEPS is defined in the altera HAL build makefiles and the elf is dependent on it.
LDDEPS+= mylib
.PHONY : mylib
Then added a rule like this to cause it to build:
mylib:
@echo ====== Making my libraries ======
$(MAKE) -C mylibdir $(MAKECMDGOALS)
@echo ====== Done making my libraries. ======
To get clean to work:
clean: libclean
libclean:
@echo ====== Cleaning the libraries ======
$(MAKE) -C mydir clean
@echo ====== Done cleaning the libraries. ======
That's about it.