MPS issue job003842

TitleMissing dependencies in nmake build system
Statusopen
Prioritynice
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionThe nmake build system lacks dependency information (for example, on headers, or mps.c on sources) and so does not reliably rebuild after a change.
AnalysisThe /showIncludes option to the compiler [1] lists the included files and the output could be postprocessed into the necessary dependencies and then included via a !INCLUDE directive in commpre.nmk. Something like this:

# == Dependencies ==

{}.c{$(PFM)\$(VARIETY)}.d:
        $(ECHO) $@
        @if not exist $(PFM) mkdir $(PFM)
        @if not exist $(PFM)\$(VARIETY) mkdir $(PFM)\$(VARIETY)
        $(CC) $(CFLAGS) /EP /Zs /showIncludes $< 2>&1 1>NUL | \
        sed -ne 's/^Note: including file: *\(.*\)/$(<F): "\1"/p' > $@

!IF [find /C "!" $(PFM)\$(VARIETY)\deps.nmk >NUL 2>&1] == 0
!INCLUDE $(PFM)\$(VARIETY)\deps.nmk
!ENDIF

But this would require users to install sed (and if they have sed, why not make?). Could guard this by an IF that tests for the existence of sed.
How foundmanual_test
Evidence[1] <http://msdn.microsoft.com/en-us/library/hdkef6tk.aspx>
Created byGareth Rees
Created on2014-06-19 10:13:09
Last modified byGareth Rees
Last modified on2015-02-04 10:51:10
History2014-06-19 GDR Created.