During today’s chat with Microsoft’s Windows CE Team, someone asked “is there a way to put additional items to the clean target without modifying makefile.def?”   So I decided to see if I could come up with a way.
It can’t be done using a sources file. Sources files are only used to set environment variable prior to nmake being called and we need a target named “clean” to handle cleaning the additional files.
That leaves makefile.inc and makefile. I tried it in makefile.inc with a WINCETARGETFILES set for a different target than clean. It didn’t work.
I added a clean as a target in the makefile after including makefile.def, that didn’t work either. On a whim, I put it before including makefile.def and it worked. The following is my test makefile.
                -@del /q file.txt
!INCLUDE $(_MAKEENVROOT)\makefile.def
This successfully deletes file.txt and the clean target in makefile.def is still functioning to clean obj and cod files.
An alternative to this would be to create your own makefile.def and include it. For this, I put a makefile.def in the root of my platform (_TARGETPLATROOT) which is an exact copy of the makefile above. Then I modified my makefile to be:
This method allow me to have a common makefile.def for my platform which will make maintenance easier in the future.
Copyright © 2009 – Bruce Eitman
All Rights Reserved