This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
win32/GNUmakefile: use pattern rules to build the miniperl objects
authorTony Cook <tony@develop-help.com>
Tue, 14 Feb 2023 22:36:57 +0000 (09:36 +1100)
committerTony Cook <tony@develop-help.com>
Mon, 31 Jul 2023 00:18:46 +0000 (10:18 +1000)
This adds implicit dependencies between the objects and their sources
so that touching the .c file and rebuilding rebuilds the miniperl
object and executable.

win32/GNUmakefile

index 4596143..41bd114 100644 (file)
@@ -1436,11 +1436,15 @@ endif
 #separate line since this is sentinal that this target is done
        @rem. > $(MINIDIR)\.exists
 
+$(MINIDIR)\\%$(o): %.c
+       $(CC) -c -I$(MINIDIR) $(CFLAGS) $(MINIBUILDOPT) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(PDBOUT) $<
+
+$(MINIDIR)\\%$(o): ..\%.c
+       $(CC) -c -I$(MINIDIR) $(CFLAGS) $(MINIBUILDOPT) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(PDBOUT) $<
+
 $(MINICORE_OBJ) : $(CORE_NOCFG_H)
-       $(CC) -c -I$(MINIDIR) $(CFLAGS) $(MINIBUILDOPT) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(PDBOUT) ..\$(*F).c
 
 $(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
-       $(CC) -c -I$(MINIDIR) $(CFLAGS) $(MINIBUILDOPT) -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(PDBOUT) $(*F).c
 
 # -DPERL_IMPLICIT_SYS needs C++ for perllib.c
 # rules wrapped in .IFs break Win9X build (we end up with unbalanced []s
@@ -1454,9 +1458,7 @@ else
        $(CC) -c -I. $(CFLAGS_O) $(OBJOUT_FLAG)$@ $(PDBOUT) perllib.c
 endif
 
-# 1. we don't want to rebuild miniperl.exe when config.h changes
-# 2. we don't want to rebuild miniperl.exe with non-default config.h
-# 3. we can't have miniperl.exe depend on git_version.h, as miniperl creates it
+# We can't have miniperl.exe depend on git_version.h, as miniperl creates it
 $(MINI_OBJ)    : $(MINIDIR)\.exists $(CORE_NOCFG_H)
 
 $(WIN32_OBJ)   : $(CORE_H)