This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: More Makefile cleanups
- From: neroden at twcny dot rr dot com (Nathanael Nerode)
- To: mark at codesourcery dot com, gcc-patches at gcc dot gnu dot org
- Date: Sat, 30 Aug 2003 15:46:11 -0400
- Subject: Re: PATCH: More Makefile cleanups
Mark Mitchell wrote:
>I'll give the build maintainers some time to reject the patch before
>checking this in.
Most of the patch (deleting all the redundant rules) is fine. The new
generic rules, however, could use some improvement.
>+ genprogs=genconfig genflags gencodes genemit genopinit genrecog genextract \
>+ genpeep genattr genoutput
>+
>+ genobjs=$(genprogs:%=%.o) read-rtl.o gensupport.o genattrtab.o \
>+ genautomata.o gengenrtl.o genpreds.o gengtype.o \
>+ genconstants.o gen-protos.o scan.o fix-header.o scan-decls.o \
>+ gencheck.o dummy-conditions.o genconditions.o
>+
>+ $(genprogs:%=%$(buildextext)): \
>+ %$(build_exeext): %.o $(BUILD_RTL) $(BUILD_SUPPORT) \
>+ $(BUILD_PRINT) $(BUILD_ERRORS) $(BUILD_LIBDEPS)
>+ $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
>+ $< $(BUILD_RTL) $(BUILD_SUPPORT) $(BUILD_PRINT) \
>+ $(BUILD_ERRORS) $(BUILD_LIBS)
This is confusing to read at first glance, especially if one is not
used to static pattern rules. It's oddly formatted and uncommented. It
also contains an important typo.
I suggest something like the following instead:
---
# Names of programs built and run on the build system.
genprognames=genconfig genflags gencodes genemit genopinit genrecog genextract \
genpeep genattr genoutput
# Actual executable names for these programs, with possible .exe
# suffix.
genprogs = $(genprognames:%=%$(build_exeext))
# Object files for these programs.
genobjs=$(genprogs:%=%.o) read-rtl.o gensupport.o genattrtab.o \
genautomata.o gengenrtl.o genpreds.o gengtype.o \
genconstants.o gen-protos.o scan.o fix-header.o scan-decls.o \
gencheck.o dummy-conditions.o genconditions.o
# General rule for building programs to run on the build system.
$(genprogs): %$(build_exeext): %.o
$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ $< \
$(BUILD_RTL) $(BUILD_SUPPORT) $(BUILD_PRINT) $(BUILD_ERRORS) \
$(BUILD_LIBS)
# Dependencies shared by all the programs built to run on the
# build system.
$(genprogs): $(BUILD_RTL) $(BUILD_SUPPORT) $(BUILD_PRINT) $(BUILD_ERRORS) \
$(BUILD_LIBDEPS)
---
OK, Mark?
>+
>+ $(genobjs): %.o : %.c
>+ $(CC_FOR_BUILD) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
>+
This last rule is fine...
--
Nathanael Nerode <neroden at gcc.gnu.org>
http://home.twcny.rr.com/nerode/neroden/fdl.html