Skip to content

Update the makefile to regenerate makedependfile when the developer changes the content of makedependfile.SH #23402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bug*.pl
/config.sh
/makeaperl
/makedepend
/makedepend_file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first few characters of the commit message are wrong

Copy link
Contributor

@khwilliamson khwilliamson Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made minor edits in the p.r. description for better English grammar. I realized it was a lot easier to just do them than to point them out.

This now looks good to me, but someone who is better at Makefiles should check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first few characters of the commit message are wrong

What is wrong in the commit message? Do you mean instead something wrong in the p.r. description that you have fixed?

/makedependfile
/makedir
/makefile
/myconfig
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ make_ext.pl Used by Makefile to execute extension Makefiles
make_patchnum.pl Script to generate git_version.h and lib/Config_git.pl files for all OS'es
makedef.pl Create symbol export lists for linking
makedepend.SH Precursor to makedepend
makedepend_file.SH Precursor to makedepend_file
makedependfile.SH Precursor to makedependfile
Makefile.SH A script that generates Makefile
malloc.c A version of malloc you might not want
malloc_ctl.h A version of malloc you might not want
Expand Down
15 changes: 9 additions & 6 deletions Makefile.SH
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ SH_to_target() {
echo $@ | sed -e s/\\\.SH//g -e s/_/./g
}

SH='Makefile.SH cflags.SH config_h.SH makedepend.SH myconfig.SH runtests.SH pod/Makefile.SH'
SH='Makefile.SH cflags.SH config_h.SH makedependfile.SH makedepend.SH myconfig.SH runtests.SH pod/Makefile.SH'
shextract=`SH_to_target $SH`

## In the following dollars and backticks do not need the extra backslash.
Expand Down Expand Up @@ -1367,7 +1367,7 @@ veryclean: _verycleaner _mopup _clobber
_mopup:
rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c $(mini_only_src) generate_uudmap$(EXE_EXT) $(generated_headers)
-rmdir .depending
-rm *.depends makedepend_file
-rm *.depends
-@test -f extra.pods && rm -f `cat extra.pods`
-@test -f vms/README_vms.pod && rm -f vms/README_vms.pod
-rm -f perl.exp ext.libs $(generated_pods) uni.data $(mini_only_objs) pod/roffitall
Expand Down Expand Up @@ -1495,11 +1495,14 @@ cscopeflags = -Rb # Recursive, build-only.
cscope.out cscope: $(c) $(h)
cscope $(cscopeflags)

# Need to unset during recursion to go out of loop.
# $(FIRSTMAKEFILE) is generated by the makedepend script.
# The makedepend script uses the makedependfile script.

# Need to unset MAKEDEPEND during recursion to go out of loop.
# The README below ensures that the dependency list is never empty and
# that when MAKEDEPEND is empty $(FIRSTMAKEFILE) doesn't need rebuilding.

MAKEDEPEND = Makefile makedepend_file makedepend
MAKEDEPEND = Makefile makedependfile makedepend
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a comment like

The purpose of makedependfile is to guarantee that things get properly rebuilt when makedependfile.SH is changed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the following comment to explain how $(FIRSTMAKEFILE) is generated and its relationship with makedepend and makedependfile. Hoping that is what you wanted...

# $(FIRSTMAKEFILE) is generated by the makedepend script.
# The makedepend script uses the makedependfile script.


$(FIRSTMAKEFILE): README $(MAKEDEPEND)
$(MAKE) depend MAKEDEPEND=
Expand All @@ -1517,11 +1520,11 @@ done
$spitshell >>$Makefile <<'!NO!SUBS!'

.PHONY: depend
depend: makedepend $(DTRACE_H) $(generated_headers)
depend: makedependfile makedepend $(DTRACE_H) $(generated_headers)
sh ./makedepend MAKE="$(MAKE)" cflags

.c.c.depends:
sh ./makedepend_file $< $@ cflags
sh ./makedependfile $< $@ cflags

.PHONY: test check test_prep test_prep_nodll test_prep_pre \
test_prep_reonly test_tty test-tty test_notty test-notty \
Expand Down
14 changes: 7 additions & 7 deletions makedepend_file.SH → makedependfile.SH
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ case "$0" in
*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
esac

echo "Extracting makedepend_file (with variable substitutions)"
rm -f makedepend_file
$spitshell >makedepend_file <<!GROK!THIS!
echo "Extracting makedependfile (with variable substitutions)"
rm -f makedependfile
$spitshell >makedependfile <<!GROK!THIS!
$startsh
# makedepend_file.SH
# makedependfile.SH
#
MAKE=$make
trnl='$trnl'
!GROK!THIS!
$spitshell >>makedepend_file <<'!NO!SUBS!'
$spitshell >>makedependfile <<'!NO!SUBS!'

file=$1
shift
Expand Down Expand Up @@ -172,5 +172,5 @@ esac
$echo "$filebase\$(OBJ_EXT): $@" >>$outfile

!NO!SUBS!
$eunicefix makedepend_file
chmod +x makedepend_file
$eunicefix makedependfile
chmod +x makedependfile
Loading