This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Makefile.in: Fix the stamp-as rule.
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: dan at codesourcery dot com
- Date: Thu, 30 Jun 2005 12:50:31 -0700
- Subject: [patch] Makefile.in: Fix the stamp-as rule.
Hi,
Attached is a patch to fix the stamp-as rule.
Specifically, this patch fixes two problems.
It's not a good idea to use "$<" in "case" command because if
$(ORIGINAL_AS_FOR_TARGET) starts with "./", then make will strip off
"./".
Once we fix the problem above, the first case (./*) is no longer dead
code. Suppose $(ORIGINAL_AS_FOR_TARGET) is "./as". Then by the time
the control gets to the first case, ./as has been deleted by "rm -r
as". This isn't good. The patch attempts to preserve "./as" by
distributing "rm -f as".
Tested on arm-none-eabi and x86_64-pc-linux-gnu. OK to apply?
p.s.
Should I be making similar changes to stamp-ld and stamp-nm?
Kazu Hirata
2005-06-30 Kazu Hirata <kazu@codesourcery.com>
* Makefile.in (stamp-as): Use $(ORIGINAL_AS_FOR_TARGET)
instead of $<. Don't remove ./as if it already exists.
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1512
diff -c -d -p -r1.1512 Makefile.in
*** Makefile.in 27 Jun 2005 12:17:21 -0000 1.1512
--- Makefile.in 28 Jun 2005 14:20:23 -0000
*************** cpp$(exeext): gcc.o cppspec.o version.o
*** 1205,1217 ****
# can be either `sometool' (if it is a script) or `sometool$(exeext)'
# (if it is a hard link).
stamp-as: $(ORIGINAL_AS_FOR_TARGET)
! @echo creating as; rm -f as; \
! case "$<" in \
! ./*) ;; \
../*) \
echo $(LN) $< as$(exeext); \
$(LN) $< as$(exeext) || cp $< as$(exeext) ;; \
! *) echo '#!$(SHELL)' > as; echo 'exec $< "$$@"' >> as ; \
chmod +x as ;; \
esac
echo timestamp > $@
--- 1205,1221 ----
# can be either `sometool' (if it is a script) or `sometool$(exeext)'
# (if it is a hard link).
stamp-as: $(ORIGINAL_AS_FOR_TARGET)
! @echo creating as; \
! case "$(ORIGINAL_AS_FOR_TARGET)" in \
! ./as) ;; \
../*) \
+ rm -f as$(exeext); \
echo $(LN) $< as$(exeext); \
$(LN) $< as$(exeext) || cp $< as$(exeext) ;; \
! *) \
! rm -f as; \
! echo '#!$(SHELL)' > as; \
! echo 'exec $(ORIGINAL_AS_FOR_TARGET) "$$@"' >> as ; \
chmod +x as ;; \
esac
echo timestamp > $@