OSDN Git Service

r110121@banpei: zack | 2006-01-22 14:39:11 -0800
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Jan 2006 15:14:53 +0000 (15:14 +0000)
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Jan 2006 15:14:53 +0000 (15:14 +0000)
         * Makefile.in: Consolidate most rules that use $(CC_FOR_BUILD) and/or
         $(RUN_GEN).  Use pattern rules to factor out as much boilerplate as
         practical.  Eliminate per-generator-program link rules.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110117 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/Makefile.in

index 6ff4fc8..e2855d8 100644 (file)
@@ -1,3 +1,9 @@
+2006-01-22  Zack Weinberg  <zackw@panix.com>
+
+       * Makefile.in: Consolidate most rules that use $(CC_FOR_BUILD) and/or
+       $(RUN_GEN).  Use pattern rules to factor out as much boilerplate as
+       practical.  Eliminate per-generator-program link rules.
+
 2006-01-23  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR middle-end/24437
 
 2006-01-20  Dirk Mueller  <dmueller@suse.com>
 
-        PR c++/5520
-        * c-parser.c (c_parser_if_body): Use build_empty_stmt()
-        instead of a special NOP marker.
-        * c-typeck.c (c_finish_if_stmt): Remove obsoleted special
-        NOP marker handling.
-        * c-common.h (empty_body_warning): Add forward declaration.
-        * c-common.c (empty_body_warning): Add (from c_finish_if_stmt).
-        Now uses IS_EMPTY_STMT() instead of special NOP markers.
+       PR c++/5520
+       * c-parser.c (c_parser_if_body): Use build_empty_stmt()
+       instead of a special NOP marker.
+       * c-typeck.c (c_finish_if_stmt): Remove obsoleted special
+       NOP marker handling.
+       * c-common.h (empty_body_warning): Add forward declaration.
+       * c-common.c (empty_body_warning): Add (from c_finish_if_stmt).
+       Now uses IS_EMPTY_STMT() instead of special NOP markers.
 
 2005-01-20  Paul Brook  <paul@codesourcery.com>
 
 
 2005-01-19  Kenneth Zadeck <zadeck@naturalbridge.com>
 
-       PR rtl-optimization/25799 
+       PR rtl-optimization/25799
        * df-problems.c (df_ru_confluence_n, df_rd_confluence_n):
        Corrected confluence operator to remove bits from op2 before oring
        with op1 rather than removing bits from op1.
-        (df_ru_transfer_function): Corrected test on wrong bitmap which
+       (df_ru_transfer_function): Corrected test on wrong bitmap which
        caused infinite loop.  Both of these problems were introduced in
        the dataflow rewrite.
 
        for the TARGET_DEEP_BRANCH_PREDICTION case.
 
 2006-01-19  Jan Hubicka  <jh@suse.cz>
-            H.J. Lu  <hongjiu.lu@intel.com>
+           H.J. Lu  <hongjiu.lu@intel.com>
            Evandro Menezes <evandro.menezes@amd.com>
 
        * invoke.texi (generic): Document
 
        * tree-vrp.c (extract_range_from_assert): Refine the result range
        if the variable referenced by the ASSERT_EXPR has a range and
-       either the tentative result range or the previous range is a 
+       either the tentative result range or the previous range is a
        VR_ANTI_RANGE.
 
 2006-01-19  Richard Sandiford  <richard@codesourcery.com>
 2006-01-19  Andreas Krebbel  <krebbel1@de.ibm.com>
 
        * config/s390/s390.md ("Y", "y"): New mode attribute.
-       ("*cmpdi_ccs", "*cmpsi_ccs", "*adddi3_imm_cc", "*adddi3_carry1_cc", 
+       ("*cmpdi_ccs", "*cmpsi_ccs", "*adddi3_imm_cc", "*adddi3_carry1_cc",
        "*adddi3_carry1_cconly", "*adddi3_carry2_cc", "*adddi3_carry2_cconly",
-       "*adddi3_cc", "*adddi3_cconly", "*adddi3_cconly2", "*adddi3_64", 
-       "*addsi3_imm_cc", "*addsi3_carry1_cc", 
+       "*adddi3_cc", "*adddi3_cconly", "*adddi3_cconly2", "*adddi3_64",
+       "*addsi3_imm_cc", "*addsi3_carry1_cc",
        "*addsi3_carry1_cconly", "*addsi3_carry2_cc", "*addsi3_carr2_cconly",
        "*addsi3_cc", "*addsi3_cconly", "*addsi3_cconly2",
-       "*subdi3_borrow_cc", "*subdi3_borrow_cconly", "*subdi3_cc", 
+       "*subdi3_borrow_cc", "*subdi3_borrow_cconly", "*subdi3_cc",
        "*subdi3_cc2", "*subdi3_cconly", "*subdi3_cconly2", "*subdi3_64",
        "*subsi3_borrow_cc", "*subsi3_borrow_cconly", "*subsi3_cc",
        "*subsi3_cc2", "*subsi3_cconly", "*subsi3_cconly", "*subsi3_cconly2",
        "*add<mode>3_carry2_cc", "*add<mode>3_carry2_cconly", "*add<mode>3_cc",
        "*add<mode>3_cconly", "*add<mode>3_cconly2", "*add<mode>3_imm_cc",
        "*sub<mode>3_borrow_cc", "*sub<mode>3_borrow_cconly",
-       "*sub<mode>3_cc", "*sub<mode>3_cc2", "*sub<mode>3_cconly", 
+       "*sub<mode>3_cc", "*sub<mode>3_cc2", "*sub<mode>3_cconly",
        "*sub<mode>3_cconly2"): New insn patterns.
        ("addsi3", "subsi3"): New expanders.
 
        (add_may_alias): Ditto.
        (replace_may_alias): Ditto.
        (get_nmt_for): Ditto.
-       (create_global_var): 
+       (create_global_var):
        (is_escape_site): Return an escape_type enumeration.
        * tree-flow-inline.h (is_call_clobbered):  Global var does not
        imply call clobbered.
        * tree-dfa.c (dump_variable): If details is on, dump the reason
        for escaping.
        * tree-outof-ssa.c (create_temp): Copy escape mask from original
-       variable. 
+       variable.
        * tree-flow.h (struct ptr_info_def): Add escape mask member.
        (struct var_ann_d): Ditto.
        (enum escape_type): New.
        (mark_call_clobbered): Adjust prototype.
        * tree-ssa-structalias.c (update_alias_info): Unmodifiable vars
-       are never call clobbered. 
+       are never call clobbered.
        Record reasons for escaping.
        * tree-ssa-structalias.h (is_escape_site): Update prototype.
        * tree-ssa-operands.c (ssa_call_clobbered_cache_valid): Remove.
        Add use of PURE_CONST information.
        (add_call_read_ops): Remove use of cache.
        Add use of static not_read information.
-       
+
 2006-01-18  Alexandre Oliva  <aoliva@redhat.com>
 
        Introduce TLS descriptors for i386 and x86_64.
        (ashrdi3): Likewise.
        (aeabi_lasr): Likewise.
        (lshrdi3): Likewise.
-       (aeabi_llsr): Likewise. 
+       (aeabi_llsr): Likewise.
        2005-03-10  Julian Brown  <julian@codesourcery.com>
        * config.gcc: Disable shared libgcc for SymbianOS.
        * config/arm/t-symbian (LIB2ADDEH): Include config/arm/pr-support.c.
        (override_options): Use the size_cost.branch_cost as the default
        ix86_branch_cost when optimizing for size.
 
-2006-01-18  Ben Elliston  <bje@au.ibm.com>     
+2006-01-18  Ben Elliston  <bje@au.ibm.com>
 
        * Makefile.in (D32PBIT_FUNCS): New.
        (D64PBIT_FUNCS, D128PBIT_FUNCS): Likewise.
        * doc/libgcc.texi (Decimal float library routines): New node.
        * config/dfp-bit.h, config/dfp-bit.c: New files.
 
-2006-01-18  Ben Elliston  <bje@au.ibm.com>     
+2006-01-18  Ben Elliston  <bje@au.ibm.com>
 
        * expr.c (emit_move_change_mode): Always adjust addresses, not
        just during reload.  Copy replacements only during reload.
        Merge from gomp branch:
        * Makefile.in (TREE_INLINE_H): New.  Use it as needed.
        * tree-inline.h (struct copy_body_data): Move from tree-inline.c
-       and rename from struct inline_data.  Rename callee* to dst*; 
+       and rename from struct inline_data.  Rename callee* to dst*;
        caller* to src*; add copy_decl hook, transform_call_graph_edges,
        transform_new_cfg, transform_return_to_modify, and
        transform_lang_insert_block flags; remove cloning_p, versioning_p,
        * doc/invoke.texi: Add documentation for -frtl-abstract-sequences.
 
 2006-01-16  Eric Botcazou  <ebotcazou@adacore.com>
-            Roger Sayle  <roger@eyesopen.com> 
+           Roger Sayle  <roger@eyesopen.com>
 
        * fold-const.c (fold_minmax): New static function.
        (fold_binary) <MIN_EXPR>: Call it.
        used to communicate with thread_through_all_blocks.
        * tree-flow.h (thread_through_all_blocks): Update prototype.
        (register_jump_thread): Prototype.
-       
+
 2006-01-11  Kazu Hirata  <kazu@codesourcery.com>
 
        * df-core.c (df_compact_blocks, df_bb_replace): Use
 2005-01-11  Kenneth Zadeck <zadeck@naturalbridge.com>
 
        * Makefile.in: Removed rotted odf.c entry.
-       
+
 2006-01-11  Hans-Peter Nilsson  <hp@axis.com>
 
        PR target/25706
        PR tree-optimization/24123
 
        * Makefile.in (tree-ssa-math-opts.o): Adjust dependencies.
-        * tree-cfg.c (single_noncomplex_succ): New.
-        * tree-flow.h (single_noncomplex_succ): Declare it.
-        * tree-ssa-math-opts.c (enum place_reciprocal): Remove.
-        * tree-ssa-math-opts.c (enum place_reciprocal): Remove.
-        (struct occurrence, occ_head, occ_pool, is_divide_by, compute_merit,
+       * tree-cfg.c (single_noncomplex_succ): New.
+       * tree-flow.h (single_noncomplex_succ): Declare it.
+       * tree-ssa-math-opts.c (enum place_reciprocal): Remove.
+       * tree-ssa-math-opts.c (enum place_reciprocal): Remove.
+       (struct occurrence, occ_head, occ_pool, is_divide_by, compute_merit,
        insert_bb, register_division_in, insert_reciprocals,
        replace_reciprocal, free_bb): New.
-        (execute_cse_reciprocals_1): Rewritten.
-        (execute_cse_reciprocals): Adjust calls to execute_cse_reciprocals_1.
-        Do not commit any edge insertion.  Always compute dominators and
-        create the allocation pool.
-        * target-def.h (TARGET_MIN_DIVISIONS_FOR_RECIP_MUL): New.
+       (execute_cse_reciprocals_1): Rewritten.
+       (execute_cse_reciprocals): Adjust calls to execute_cse_reciprocals_1.
+       Do not commit any edge insertion.  Always compute dominators and
+       create the allocation pool.
+       * target-def.h (TARGET_MIN_DIVISIONS_FOR_RECIP_MUL): New.
        * target.h (struct gcc_target): Add min_divistions_for_recip_mul.
        * targhooks.c (default_min_divistions_for_recip_mul): New.
        * targhooks.h (default_min_divistions_for_recip_mul): New prototype.
-        * passes.c (init_optimization_passes): Run recip after tree loop
-        optimizations.
-        * doc/tm.texi (Misc): Document TARGET_MIN_DIVISIONS_FOR_RECIP_MUL.
+       * passes.c (init_optimization_passes): Run recip after tree loop
+       optimizations.
+       * doc/tm.texi (Misc): Document TARGET_MIN_DIVISIONS_FOR_RECIP_MUL.
 
 2005-01-11  Danny Berlin <dberlin@dberlin.org>
-            Kenneth Zadeck <zadeck@naturalbridge.com>
+           Kenneth Zadeck <zadeck@naturalbridge.com>
 
        * df.h (DF_SCAN, DF_RU, DF_RD, DF_LR, DF_UR, DF_UREC, DF_CHAIN,
        DF_RI, DF_LAST_PROBLEM_PLUS1, DF_DU_CHAIN, DF_UD_CHAIN,
        df_ref_remove, df_insn_refs_delete, df_refs_delete,
        df_reorganize_refs, df_set_state, df_hard_reg_init,
        df_read_modify_subreg_p) New public functions.
-        * df-core.c: The core dataflow solver and glue routines for rtl
+       * df-core.c: The core dataflow solver and glue routines for rtl
        dataflow.
        (df_init, df_add_problem, df_set_blocks, df_finish,
        df_hybrid_search_forward, df_hybrid_search_backward,
        df_ri_compute, df_ri_free, df_ri_dump, df_ri_add_problem,
        df_reg_lifetime): New functions.
        * df.c: Deleted file.
-        * ddg.c (create_ddg_dep_no_link, build_inter_loop_deps): Made code
+       * ddg.c (create_ddg_dep_no_link, build_inter_loop_deps): Made code
        consistent with new df api.
-        * modulo-sched.c (sms_schedule, rest_of_handle_sms,
-        rest_of_handle_sms): Ditto.
-        * web.c (unionfind_union, union_defs, entry_register, web_main):
+       * modulo-sched.c (sms_schedule, rest_of_handle_sms,
+       rest_of_handle_sms): Ditto.
+       * web.c (unionfind_union, union_defs, entry_register, web_main):
        Ditto.
        * loop_invariant.c (invariant_for_use, hash_invariant_expr_1,
        invariant_expr_equal_p, find_defs, check_dependencies,
        find_invariant_insn, find_invariants_to_move, move_invariant_reg,
        free_inv_motion_data, move_loop_invariants): Ditto.
-       * Makefile.in (df.c, df-scan.c df-problems.c df-core.c): 
+       * Makefile.in (df.c, df-scan.c df-problems.c df-core.c):
        Update dependencies.
        (odf.c): Added defective entry that was deleted later in day.
        * sched-deps.c (sched_analyze_1): Ditto.
            Richard Henderson  <rth@redhat.com>
 
        Merge from gomp-branch:
-        * varasm.c (assemble_variable): Handle thread-local COMMON data.
-        * defaults.h (ASM_OUTPUT_TLS_COMMON): Define.
+       * varasm.c (assemble_variable): Handle thread-local COMMON data.
+       * defaults.h (ASM_OUTPUT_TLS_COMMON): Define.
 
 2006-01-03  Paolo Bonzini  <bonzini@gnu.org>
 
        Don't clear have_location_lists.
 
 2006-01-02  Eric Botcazou  <ebotcazou@adacore.com>
-            Jan Hubicka  <jh@suse.cz>
+           Jan Hubicka  <jh@suse.cz>
 
        * cfglayout.c (fixup_reorder_chain): Remove kludge for the
        case of conditional jump jumping to the next instruction.
 
 2006-01-02  Paolo Bonzini  <bonzini@gnu.org>
 
-        PR target/25259
-        * Makefile.in (DECNUMINC): Include libdecnumber's build directory.
+       PR target/25259
+       * Makefile.in (DECNUMINC): Include libdecnumber's build directory.
 
 2006-01-02  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
index db18318..6e8553c 100644 (file)
@@ -1367,6 +1367,8 @@ $(SPECS): xgcc$(exeext)
 gcc-cross: xgcc$(exeext)
        cp xgcc$(exeext) gcc-cross$(exeext)
 
+dummy-checksum.o : dummy-checksum.c
+
 cc1-dummy$(exeext): $(C_OBJS) dummy-checksum.o $(BACKEND) $(LIBDEPS)
        $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) dummy-checksum.o \
          $(BACKEND) $(LIBS)
@@ -1708,27 +1710,6 @@ gccspec.o: gccspec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H)
 
 cppspec.o: cppspec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H)
 
-build/genchecksum$(build_exeext) : build/genchecksum.o $(BUILD_LIBDEPS)
-       $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
-        build/genchecksum.o $(BUILD_LIBS)
-
-build/genchecksum.o : genchecksum.c $(BCONFIG_H) $(SYSTEM_H) $(MD5_H)
-
-dummy-checksum.o : dummy-checksum.c
-
-tree-check.h: s-check ; @true
-s-check : build/gencheck$(build_exeext)
-       $(RUN_GEN) build/gencheck$(build_exeext) > tmp-check.h
-       $(SHELL) $(srcdir)/../move-if-change tmp-check.h tree-check.h
-       $(STAMP) s-check
-
-build/gencheck$(build_exeext) : build/gencheck.o $(BUILD_LIBDEPS)
-       $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
-        build/gencheck.o $(BUILD_LIBS)
-
-build/gencheck.o : gencheck.c gencheck.h tree.def $(BCONFIG_H) $(SYSTEM_H) \
-       coretypes.h $(GTM_H) $(lang_tree_files)
-
 gencheck.h : s-gencheck ; @true
 s-gencheck : Makefile
        ltf="$(lang_tree_files)"; for f in $$ltf; do \
@@ -2657,188 +2638,121 @@ s-mddeps: $(md_file) $(MD_INCLUDES) build/genmddeps$(build_exeext)
        $(SHELL) $(srcdir)/../move-if-change tmp-mddeps mddeps.mk
        $(STAMP) s-mddeps
 
-# The following pair of rules has this effect:
-# genconfig is run only if the md has changed since genconfig was last run;
-# but the file insn-config.h is touched only when its contents actually change.
-
-# Each of the other insn-* files is handled by a similar pair of rules.
-
-# This causes an anomaly in the results of make -n
-# because insn-* is older than s-*
-# and thus make -n thinks that insn-* will be updated
-# and force recompilation of things that depend on it.
-# We use move-if-change precisely to avoid such recompilation.
-# But there is no way to teach make -n that it will be avoided.
-
-# Each of the insn-*.[ch] rules has a semicolon at the end,
-# for otherwise the system Make on SunOS 4.1 never tries
-# to recompile insn-*.o.  To avoid problems and extra noise from
-# versions of make which don't like empty commands (nothing after the
-# trailing `;'), we call true for each.
-
-insn-config.h: s-config ; @true
-s-config : $(MD_DEPS) build/genconfig$(build_exeext)
-       $(RUN_GEN) build/genconfig$(build_exeext) $(md_file) > tmp-config.h
-       $(SHELL) $(srcdir)/../move-if-change tmp-config.h insn-config.h
-       $(STAMP) s-config
-
-insn-conditions.c: s-conditions ; @true
-s-conditions : $(MD_DEPS) build/genconditions$(build_exeext)
-       $(RUN_GEN) build/genconditions$(build_exeext) $(md_file) > tmp-conditions.c
-       $(SHELL) $(srcdir)/../move-if-change tmp-conditions.c insn-conditions.c
-       $(STAMP) s-conditions
-
-build/insn-conditions.o : insn-conditions.c $(CONFIG_H) $(SYSTEM_H) \
-  $(GTM_H) $(RTL_H) $(TM_P_H) $(REGS_H) $(FUNCTION_H) $(RECOG_H) real.h output.h \
-  $(FLAGS_H) hard-reg-set.h $(RESOURCE_H) toplev.h reload.h gensupport.h \
-  insn-constants.h coretypes.h
+# Header dependencies for generated source files.
+genrtl.o : genrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)        $(RTL_H)\
+  $(GGC_H)
+insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h    \
+  $(TM_H) $(RTL_H) $(REGS_H) real.h output.h $(INSN_ATTR_H)            \
+  insn-config.h toplev.h $(RECOG_H) $(TM_P_H) $(FLAGS_H)
+insn-emit.o : insn-emit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)  \
+  $(RTL_H) $(EXPR_H) real.h output.h insn-config.h $(OPTABS_H)         \
+  reload.h $(RECOG_H) toplev.h $(FUNCTION_H) $(FLAGS_H) hard-reg-set.h \
+  $(RESOURCE_H) $(TM_P_H) $(BASIC_BLOCK_H)
+insn-extract.o : insn-extract.c $(CONFIG_H) $(SYSTEM_H) coretypes.h    \
+  $(TM_H) $(RTL_H) toplev.h insn-config.h $(RECOG_H)
+insn-modes.o : insn-modes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h        $(TM_H) \
+  $(MACHMODE_H) real.h
+insn-opinit.o : insn-opinit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h      \
+  $(TM_H) $(RTL_H) insn-config.h $(FLAGS_H) $(RECOG_H) $(EXPR_H)       \
+  $(OPTABS_H) reload.h
+insn-output.o : insn-output.c $(CONFIG_H) $(SYSTEM_H) coretypes.h      \
+  $(TM_H) $(RTL_H) $(GGC_H) $(REGS_H) real.h conditions.h              \
+  hard-reg-set.h insn-config.h $(INSN_ATTR_H) $(EXPR_H) output.h       \
+  $(RECOG_H) $(FUNCTION_H) toplev.h $(FLAGS_H) insn-codes.h $(TM_P_H)  \
+  $(TARGET_H)
+insn-peep.o : insn-peep.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)  \
+  $(RTL_H) $(REGS_H) output.h real.h insn-config.h $(RECOG_H) except.h \
+  $(FUNCTION_H) $(TM_P_H)
+insn-preds.o : insn-preds.c $(CONFIG_H) $(SYSTEM_H) coretypes.h                \
+  $(TM_H) $(RTL_H) $(TREE_H) insn-config.h $(RECOG_H) real.h output.h  \
+  $(FLAGS_H) $(FUNCTION_H) hard-reg-set.h $(RESOURCE_H) $(TM_P_H)              \
+  toplev.h reload.h $(REGS_H)
+insn-recog.o : insn-recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h                \
+  $(TM_H) $(RTL_H) insn-config.h $(RECOG_H) real.h output.h $(FLAGS_H) \
+  $(FUNCTION_H) hard-reg-set.h $(RESOURCE_H) $(TM_P_H) toplev.h reload.h
+
+# For each of the files generated by running a generator program over
+# the machine description, the following pair of static pattern rules
+# runs the generator program only if the machine description has changed,
+# but touches the target file only when its contents actually change.
+# The "; @true" construct forces Make to recheck the timestamp on the
+# target file.
+
+simple_generated_h = insn-attr.h insn-codes.h insn-config.h    \
+                    insn-constants.h insn-flags.h 
+
+simple_generated_c = insn-attrtab.c insn-conditions.c insn-emit.c \
+                    insn-extract.c insn-opinit.c insn-output.c \
+                    insn-peep.c insn-recog.c
+
+$(simple_generated_h): insn-%.h: s-%; @true
+
+$(simple_generated_h:insn-%.h=s-%): s-%: $(MD_DEPS) build/gen%$(build_exeext)
+       $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) > tmp-$*.h
+       $(SHELL) $(srcdir)/../move-if-change tmp-$*.h insn-$*.h
+       $(STAMP) s-$*
+
+$(simple_generated_c): insn-%.c: s-%; @true
+$(simple_generated_c:insn-%.c=s-%): s-%: $(MD_DEPS) build/gen%$(build_exeext)
+       $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) > tmp-$*.c
+       $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
+       $(STAMP) s-$*
+
+# gencheck doesn't read the machine description, and the file produced
+# doesn't use the insn-* convention.
+tree-check.h: s-check ; @true
+s-check : build/gencheck$(build_exeext)
+       $(RUN_GEN) build/gencheck$(build_exeext) > tmp-check.h
+       $(SHELL) $(srcdir)/../move-if-change tmp-check.h tree-check.h
+       $(STAMP) s-check
 
-build/dummy-conditions.o : dummy-conditions.c
+# These files are generated by running the same generator more than
+# once with different options, so they have custom rules.  The
+# stampfile idiom is the same.
+genrtl.c: s-genrtl; @true
+genrtl.h: s-genrtl-h; @true
 
-insn-flags.h: s-flags ; @true
-s-flags : $(MD_DEPS) build/genflags$(build_exeext)
-       $(RUN_GEN) build/genflags$(build_exeext) $(md_file) > tmp-flags.h
-       $(SHELL) $(srcdir)/../move-if-change tmp-flags.h insn-flags.h
-       $(STAMP) s-flags
-
-insn-codes.h: s-codes ; @true
-s-codes : $(MD_DEPS) build/gencodes$(build_exeext)
-       $(RUN_GEN) build/gencodes$(build_exeext) $(md_file) > tmp-codes.h
-       $(SHELL) $(srcdir)/../move-if-change tmp-codes.h insn-codes.h
-       $(STAMP) s-codes
-
-insn-constants.h: s-constants ; @true
-s-constants : $(MD_DEPS) build/genconstants$(build_exeext)
-       $(RUN_GEN) build/genconstants$(build_exeext) $(md_file) > tmp-constants.h
-       $(SHELL) $(srcdir)/../move-if-change tmp-constants.h insn-constants.h
-       $(STAMP) s-constants
-
-insn-emit.o : insn-emit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
-  $(RTL_H) $(EXPR_H) real.h output.h insn-config.h $(OPTABS_H) reload.h \
-  $(RECOG_H) toplev.h $(FUNCTION_H) $(FLAGS_H) hard-reg-set.h $(RESOURCE_H) \
-  $(TM_P_H) $(BASIC_BLOCK_H)
-       $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) -c insn-emit.c \
-         $(OUTPUT_OPTION)
-
-insn-emit.c: s-emit ; @true
-s-emit : $(MD_DEPS) build/genemit$(build_exeext)
-       $(RUN_GEN) build/genemit$(build_exeext) $(md_file) > tmp-emit.c
-       $(SHELL) $(srcdir)/../move-if-change tmp-emit.c insn-emit.c
-       $(STAMP) s-emit
-
-insn-recog.o : insn-recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
-  $(RTL_H) insn-config.h $(RECOG_H) real.h output.h $(FLAGS_H)  $(FUNCTION_H) \
-  hard-reg-set.h $(RESOURCE_H) $(TM_P_H) toplev.h reload.h
-       $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) -c insn-recog.c \
-         $(OUTPUT_OPTION)
-
-insn-recog.c: s-recog ; @true
-s-recog : $(MD_DEPS) build/genrecog$(build_exeext)
-       $(RUN_GEN) build/genrecog$(build_exeext) $(md_file) > tmp-recog.c
-       $(SHELL) $(srcdir)/../move-if-change tmp-recog.c insn-recog.c
-       $(STAMP) s-recog
-
-insn-opinit.o : insn-opinit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
-  $(RTL_H) insn-config.h $(FLAGS_H) $(RECOG_H) $(EXPR_H) $(OPTABS_H) reload.h
-       $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) -c insn-opinit.c \
-         $(OUTPUT_OPTION)
-
-insn-opinit.c: s-opinit ; @true
-s-opinit : $(MD_DEPS) build/genopinit$(build_exeext)
-       $(RUN_GEN) build/genopinit$(build_exeext) $(md_file) > tmp-opinit.c
-       $(SHELL) $(srcdir)/../move-if-change tmp-opinit.c insn-opinit.c
-       $(STAMP) s-opinit
-
-insn-extract.o : insn-extract.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
-  $(RTL_H) toplev.h insn-config.h $(RECOG_H)
-       $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) -c insn-extract.c \
-         $(OUTPUT_OPTION)
-
-insn-extract.c: s-extract ; @true
-s-extract : $(MD_DEPS) build/genextract$(build_exeext)
-       $(RUN_GEN) build/genextract$(build_exeext) $(md_file) > tmp-extract.c
-       $(SHELL) $(srcdir)/../move-if-change tmp-extract.c insn-extract.c
-       $(STAMP) s-extract
-
-insn-peep.o : insn-peep.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
-  $(RTL_H) $(REGS_H) output.h real.h insn-config.h $(RECOG_H) except.h \
-  $(FUNCTION_H) $(TM_P_H)
-       $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) -c insn-peep.c \
-         $(OUTPUT_OPTION)
-
-insn-peep.c: s-peep ; @true
-s-peep : $(MD_DEPS) build/genpeep$(build_exeext)
-       $(RUN_GEN) build/genpeep$(build_exeext) $(md_file) > tmp-peep.c
-       $(SHELL) $(srcdir)/../move-if-change tmp-peep.c insn-peep.c
-       $(STAMP) s-peep
-
-insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
-  $(RTL_H) $(REGS_H) real.h output.h $(INSN_ATTR_H) insn-config.h toplev.h \
-  $(RECOG_H) $(TM_P_H) $(FLAGS_H)
-       $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) -c insn-attrtab.c \
-         $(OUTPUT_OPTION)
-
-insn-attr.h: s-attr ; @true
-s-attr : $(MD_DEPS) build/genattr$(build_exeext)
-       $(RUN_GEN) build/genattr$(build_exeext) $(md_file) > tmp-attr.h
-       $(SHELL) $(srcdir)/../move-if-change tmp-attr.h insn-attr.h
-       $(STAMP) s-attr
-
-insn-attrtab.c: s-attrtab ; @true
-s-attrtab : $(MD_DEPS) build/genattrtab$(build_exeext)
-       $(RUN_GEN) build/genattrtab$(build_exeext) $(md_file) > tmp-attrtab.c
-       $(SHELL) $(srcdir)/../move-if-change tmp-attrtab.c insn-attrtab.c
-       $(STAMP) s-attrtab
-
-insn-output.o : insn-output.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
-  $(RTL_H) $(GGC_H) $(REGS_H) real.h conditions.h hard-reg-set.h \
-  insn-config.h $(INSN_ATTR_H) $(EXPR_H) output.h $(RECOG_H) $(FUNCTION_H) \
-  toplev.h $(FLAGS_H) insn-codes.h $(TM_P_H) $(TARGET_H)
-       $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) -c insn-output.c \
-         $(OUTPUT_OPTION)
-
-insn-output.c: s-output ; @true
-s-output : $(MD_DEPS) build/genoutput$(build_exeext)
-       $(RUN_GEN) build/genoutput$(build_exeext) $(md_file) > tmp-output.c
-       $(SHELL) $(srcdir)/../move-if-change tmp-output.c insn-output.c
-       $(STAMP) s-output
-
-genrtl.o : genrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
-  $(GGC_H)
-genrtl.c genrtl.h : s-genrtl; @true
 s-genrtl: build/gengenrtl$(build_exeext)
-       $(RUN_GEN) build/gengenrtl$(build_exeext) -h > tmp-genrtl.h
-       $(SHELL) $(srcdir)/../move-if-change tmp-genrtl.h genrtl.h
        $(RUN_GEN) build/gengenrtl$(build_exeext) > tmp-genrtl.c
        $(SHELL) $(srcdir)/../move-if-change tmp-genrtl.c genrtl.c
        $(STAMP) s-genrtl
 
-insn-modes.o : insn-modes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
-              $(MACHMODE_H) real.h
-min-insn-modes.c insn-modes.c insn-modes.h : s-modes ; @true
+s-genrtl-h: build/gengenrtl$(build_exeext)
+       $(RUN_GEN) build/gengenrtl$(build_exeext) -h > tmp-genrtl.h
+       $(SHELL) $(srcdir)/../move-if-change tmp-genrtl.h genrtl.h
+       $(STAMP) s-genrtl-h
+
+insn-modes.c: s-modes; @true
+insn-modes.h: s-modes-h; @true
+min-insn-modes.c: s-modes-m; @true
 
 s-modes: build/genmodes$(build_exeext)
+       $(RUN_GEN) build/genmodes$(build_exeext) > tmp-modes.c
+       $(SHELL) $(srcdir)/../move-if-change tmp-modes.c insn-modes.c
+       $(STAMP) s-modes
+
+s-modes-h: build/genmodes$(build_exeext)
        $(RUN_GEN) build/genmodes$(build_exeext) -h > tmp-modes.h
        $(SHELL) $(srcdir)/../move-if-change tmp-modes.h insn-modes.h
+       $(STAMP) s-modes-h
+
+s-modes-m: build/genmodes$(build_exeext)
        $(RUN_GEN) build/genmodes$(build_exeext) -m > tmp-min-modes.c
        $(SHELL) $(srcdir)/../move-if-change tmp-min-modes.c min-insn-modes.c
-       $(RUN_GEN) build/genmodes$(build_exeext) > tmp-modes.c
-       $(SHELL) $(srcdir)/../move-if-change tmp-modes.c insn-modes.c
-       $(STAMP) s-modes
+       $(STAMP) s-modes-m
 
-insn-preds.c tm-preds.h: s-preds; @true
+insn-preds.c: s-preds; @true
+tm-preds.h: s-preds-h; @true
 
 s-preds: $(MD_DEPS) build/genpreds$(build_exeext)
-       $(RUN_GEN) build/genpreds$(build_exeext) -h $(md_file) > tmp-preds.h
-       $(SHELL) $(srcdir)/../move-if-change tmp-preds.h tm-preds.h
        $(RUN_GEN) build/genpreds$(build_exeext) $(md_file) > tmp-preds.c
        $(SHELL) $(srcdir)/../move-if-change tmp-preds.c insn-preds.c
        $(STAMP) s-preds
 
-insn-preds.o : insn-preds.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
-  $(RTL_H) $(TREE_H) insn-config.h $(RECOG_H) real.h output.h $(FLAGS_H) \
-  $(FUNCTION_H) hard-reg-set.h $(RESOURCE_H) $(TM_P_H) toplev.h reload.h \
-  $(REGS_H)
+s-preds-h: $(MD_DEPS) build/genpreds$(build_exeext)
+       $(RUN_GEN) build/genpreds$(build_exeext) -h $(md_file) > tmp-preds.h
+       $(SHELL) $(srcdir)/../move-if-change tmp-preds.h tm-preds.h
+       $(STAMP) s-preds-h
 
 GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \
   $(CPP_ID_DATA_H) $(host_xm_file_list) \
@@ -2938,177 +2852,126 @@ s-gtype: build/gengtype$(build_exeext) $(GTFILES)
        $(STAMP) s-gtype
 
 #\f
-# Compile the programs that generate insn-* from the machine description.
-# They are compiled with $(CC_FOR_BUILD), and associated libraries,
-# since they need to run on this machine
-# even if GCC is being compiled to run on some other machine.
-
-# $(CONFIG_H) is omitted from the deps of the gen*.o
-# because these programs don't really depend on anything
-# about the target machine.  They do depend on config.h itself,
-# since that describes the host machine.
-
-# The names of programs that run on the "build" machine.
-genprognames=genconfig genflags gencodes genemit genopinit genrecog \
-            genextract genpeep genattr genoutput
-
-# The names of the executable files for those programs.
-genprogs=$(genprognames:%=build/%$(build_exeext))
-
-# Object files used in those programs.
-genobjnames=$(genprognames:%=%.o) read-rtl.o gensupport.o genattrtab.o \
-        genautomata.o gengenrtl.o genmodes.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 errors.o ggc-none.o \
-       min-insn-modes.o rtl.o print-rtl.o varray.o gcov-iov.o \
-       insn-conditions.o gengtype-lex.o gengtype-yacc.o genmddeps.o \
-       genchecksum.o
-
-genobjs=$(genobjnames:%=build/%)
-
-$(genprogs): %$(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)
+# How to compile object files to run on the build machine.
 
-$(genobjs): %.o :  # dependencies provided by explicit rule later
+build/%.o :  # dependencies provided by explicit rule later
        $(CC_FOR_BUILD) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -o $@ $<
 
-build/read-rtl.o: read-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) \
-  $(RTL_BASE_H) $(OBSTACK_H) $(HASHTAB_H)
-
-build/gensupport.o: gensupport.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
-  $(GTM_H) $(RTL_BASE_H) $(OBSTACK_H) errors.h $(HASHTAB_H) gensupport.h
-
-build/genconfig.o : genconfig.c $(RTL_BASE_H) $(BCONFIG_H) \
-  $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h
-
-build/genflags.o : genflags.c $(RTL_BASE_H) $(OBSTACK_H) $(BCONFIG_H) \
-  $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h
-
-build/gencodes.o : gencodes.c $(RTL_BASE_H) $(BCONFIG_H) \
-  $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h
-
-build/genmddeps$(build_exeext) : build/genmddeps.o $(BUILD_RTL) \
-  $(BUILD_EARLY_SUPPORT) $(BUILD_ERRORS) $(BUILD_LIBDEPS)
-       $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
-        build/genmddeps.o $(BUILD_EARLY_SUPPORT) $(BUILD_RTL) \
-        $(BUILD_ERRORS) $(BUILD_LIBS)
-
-build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
-  $(GTM_H) $(RTL_BASE_H) errors.h gensupport.h
-
-build/genconstants$(build_exeext) : build/genconstants.o $(BUILD_RTL) \
-  $(BUILD_EARLY_SUPPORT) $(BUILD_ERRORS) $(BUILD_LIBDEPS)
-       $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
-        build/genconstants.o $(BUILD_EARLY_SUPPORT) $(BUILD_RTL) \
-        $(BUILD_ERRORS) $(BUILD_LIBS)
-
-build/genconstants.o : genconstants.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
-  coretypes.h $(GTM_H) errors.h
+# Header dependencies for the programs that generate source code.
+# These are library modules...
+build/dummy-conditions.o : dummy-conditions.c
+build/errors.o : errors.c $(BCONFIG_H) $(SYSTEM_H) errors.h
+build/gensupport.o: gensupport.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h  \
+  $(GTM_H) $(RTL_BASE_H) $(OBSTACK_H) errors.h $(HASHTAB_H)            \
+  gensupport.h
+build/ggc-none.o : ggc-none.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h     \
+  $(GGC_H)
+build/min-insn-modes.o : min-insn-modes.c $(BCONFIG_H) $(SYSTEM_H)     \
+  $(MACHMODE_H)
+build/print-rtl.o: print-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h    \
+  $(GTM_H) $(RTL_BASE_H)
+build/read-rtl.o: read-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h      \
+  $(GTM_H) $(RTL_BASE_H) $(OBSTACK_H) $(HASHTAB_H)
+build/rtl.o: rtl.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H)       \
+  $(RTL_H) real.h $(GGC_H) errors.h
+build/varray.o: varray.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) \
+  $(VARRAY_H) $(RTL_BASE_H) $(GGC_H) $(TREE_H) bitmap.h errors.h
+build/insn-conditions.o : insn-conditions.c $(CONFIG_H) $(SYSTEM_H)    \
+  $(GTM_H) $(RTL_H) $(TM_P_H) $(REGS_H) $(FUNCTION_H) $(RECOG_H) real.h        \
+  output.h $(FLAGS_H) hard-reg-set.h $(RESOURCE_H) toplev.h reload.h   \
+  gensupport.h insn-constants.h coretypes.h
 
-build/genemit.o : genemit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
+# ...these are the programs themselves.
+build/genattr.o : genattr.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)     \
   coretypes.h $(GTM_H) errors.h gensupport.h
-
-build/genopinit.o : genopinit.c $(RTL_BASE_H) $(BCONFIG_H) \
-  $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h
-
-build/genrecog.o : genrecog.c $(RTL_BASE_H) $(BCONFIG_H) \
-  $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h
-
-build/genextract.o : genextract.c $(RTL_BASE_H) $(BCONFIG_H) \
-  $(SYSTEM_H) coretypes.h $(GTM_H) insn-config.h errors.h gensupport.h
-
-build/genpeep.o : genpeep.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
+build/genattrtab.o : genattrtab.c $(RTL_BASE_H) $(OBSTACK_H)           \
+  $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(GGC_H)      \
+  gensupport.h genattrtab.h
+build/genautomata.o : genautomata.c $(RTL_BASE_H) $(OBSTACK_H)         \
+  $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(VARRAY_H)   \
+  genattrtab.h $(HASHTAB_H)
+build/gencheck.o : gencheck.c gencheck.h tree.def $(BCONFIG_H) $(GTM_H)        \
+       $(SYSTEM_H) coretypes.h $(lang_tree_files)
+build/genchecksum.o : genchecksum.c $(BCONFIG_H) $(SYSTEM_H) $(MD5_H)
+build/gencodes.o : gencodes.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)   \
   coretypes.h $(GTM_H) errors.h gensupport.h
-
-build/genattr.o : genattr.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
+build/genconditions.o : genconditions.c $(RTL_BASE_H) $(BCONFIG_H)     \
+  $(SYSTEM_H) coretypes.h $(GTM_H) errors.h
+build/genconfig.o : genconfig.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
   coretypes.h $(GTM_H) errors.h gensupport.h
-
-build/genattrtab$(build_exeext) : build/genattrtab.o build/genautomata.o \
-  $(BUILD_RTL) $(BUILD_SUPPORT) $(BUILD_PRINT) $(BUILD_ERRORS) \
-  $(BUILD_VARRAY) $(BUILD_LIBDEPS)
-       $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
-        build/genattrtab.o build/genautomata.o \
-        $(BUILD_RTL) $(BUILD_SUPPORT) $(BUILD_PRINT) $(BUILD_ERRORS) \
-        $(BUILD_VARRAY) $(BUILD_LIBS) -lm
-
-build/genattrtab.o : genattrtab.c $(RTL_BASE_H) $(OBSTACK_H) $(BCONFIG_H) \
-  $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(GGC_H) gensupport.h genattrtab.h
-
-build/genautomata.o : genautomata.c $(RTL_BASE_H) $(OBSTACK_H) $(BCONFIG_H) \
-  $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(VARRAY_H) genattrtab.h \
-  $(HASHTAB_H)
-
-build/genoutput.o : genoutput.c $(RTL_BASE_H) $(BCONFIG_H) \
+build/genconstants.o : genconstants.c $(RTL_BASE_H) $(BCONFIG_H)       \
+  $(SYSTEM_H) coretypes.h $(GTM_H) errors.h
+build/genemit.o : genemit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)     \
+  coretypes.h $(GTM_H) errors.h gensupport.h
+build/genextract.o : genextract.c $(RTL_BASE_H) $(BCONFIG_H)           \
+  $(SYSTEM_H) coretypes.h $(GTM_H) insn-config.h errors.h gensupport.h
+build/genflags.o : genflags.c $(RTL_BASE_H) $(OBSTACK_H) $(BCONFIG_H)  \
   $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h
-
-build/gengenrtl$(build_exeext) : build/gengenrtl.o $(BUILD_ERRORS) \
-  $(BUILD_LIBDEPS)
-       $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
-        build/gengenrtl.o $(BUILD_ERRORS) $(BUILD_LIBS)
-
 build/gengenrtl.o : gengenrtl.c $(BCONFIG_H) $(SYSTEM_H) rtl.def
+build/gengtype-lex.o : gengtype-lex.c gengtype.h gengtype-yacc.h       \
+  $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) vec.h
+build/gengtype-yacc.o : gengtype-yacc.c gengtype.h $(BCONFIG_H)                \
+  $(SYSTEM_H) coretypes.h $(GTM_H)
+build/gengtype.o : gengtype.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h     \
+  $(GTM_H) gengtype.h gtyp-gen.h rtl.def insn-notes.def errors.h
+build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h    \
+  $(GTM_H) $(RTL_BASE_H) errors.h gensupport.h
+build/genmodes.o : genmodes.c $(BCONFIG_H) $(SYSTEM_H) errors.h                \
+  $(HASHTAB_H) machmode.def $(extra_modes_file)
+build/genopinit.o : genopinit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
+  coretypes.h $(GTM_H) errors.h gensupport.h
+build/genoutput.o : genoutput.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
+  coretypes.h $(GTM_H) errors.h gensupport.h
+build/genpeep.o : genpeep.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)     \
+  coretypes.h $(GTM_H) errors.h gensupport.h
+build/genpreds.o : genpreds.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)   \
+  coretypes.h $(GTM_H) errors.h gensupport.h $(OBSTACK_H)
+build/genrecog.o : genrecog.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)   \
+  coretypes.h $(GTM_H) errors.h gensupport.h
 
-build/genmodes$(build_exeext) : build/genmodes.o $(BUILD_ERRORS) \
-  $(BUILD_LIBDEPS)
-       $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
-        build/genmodes.o $(BUILD_ERRORS) $(BUILD_LIBS)
-
-build/genmodes.o : genmodes.c $(BCONFIG_H) $(SYSTEM_H) errors.h $(HASHTAB_H) \
-            machmode.def $(extra_modes_file)
+# Compile the programs that generate insn-* from the machine description.
+# They are compiled with $(CC_FOR_BUILD), and associated libraries,
+# since they need to run on this machine
+# even if GCC is being compiled to run on some other machine.
 
-build/genpreds$(build_exeext) : build/genpreds.o $(BUILD_RTL) \
-  $(BUILD_EARLY_SUPPORT) $(BUILD_PRINT) $(BUILD_ERRORS) $(BUILD_LIBDEPS)
+# As a general rule...
+build/gen%$(build_exeext): build/gen%.o $(BUILD_LIBDEPS)
        $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
-        build/genpreds.o $(BUILD_RTL) $(BUILD_EARLY_SUPPORT) $(BUILD_PRINT) \
-        $(BUILD_ERRORS) $(BUILD_LIBS)
+           $(filter-out $(BUILD_LIBDEPS), $^) $(BUILD_LIBS)
 
-build/genpreds.o : genpreds.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
-  coretypes.h $(GTM_H) errors.h gensupport.h $(OBSTACK_H)
+# All these programs have the same additional dependency set.
+genprognormal = attr codes config emit extract flags opinit output peep recog
+$(genprognormal:%=build/gen%$(build_exeext)): $(BUILD_RTL) $(BUILD_SUPPORT) \
+  $(BUILD_PRINT) $(BUILD_ERRORS)
 
-build/gengtype$(build_exeext) : build/gengtype.o build/gengtype-lex.o \
-  build/gengtype-yacc.o $(BUILD_LIBDEPS) $(BUILD_ERRORS)
-       $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
-        build/gengtype.o build/gengtype-lex.o build/gengtype-yacc.o \
-        $(BUILD_ERRORS) $(BUILD_LIBS)
+# And all of these, but it's a different set.
+genprogearly = mddeps constants conditions preds
+$(genprogearly:%=build/gen%$(build_exeext)): $(BUILD_RTL) $(BUILD_ERRORS) \
+  $(BUILD_EARLY_SUPPORT)
+build/genpreds$(build_exeext) : $(BUILD_PRINT)
 
-build/gengtype.o : gengtype.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) \
-  gengtype.h gtyp-gen.h rtl.def insn-notes.def errors.h
+build/gengenrtl$(build_exeext) : $(BUILD_ERRORS)
+build/genmodes$(build_exeext) : $(BUILD_ERRORS)
 
-build/gengtype-lex.o : gengtype-lex.c gengtype.h gengtype-yacc.h \
-  $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) vec.h
+# These programs are made from more than one source file.
+# The primary source file comes from the pattern rule above.
+build/genattrtab$(build_exeext) : build/genautomata.o \
+  $(BUILD_RTL) $(BUILD_SUPPORT) $(BUILD_PRINT) $(BUILD_ERRORS) \
+  $(BUILD_VARRAY)
+build/genattrtab$(build_exeext) : BUILD_LIBS += -lm
 
-build/gengtype-yacc.o : gengtype-yacc.c gengtype.h $(BCONFIG_H) $(SYSTEM_H) \
-  coretypes.h $(GTM_H)
+build/gengtype$(build_exeext) : build/gengtype-lex.o \
+  build/gengtype-yacc.o $(BUILD_ERRORS)
 
+# Generated source files for gengtype.
 gengtype-lex.c : gengtype-lex.l
        -$(FLEX) $(FLEXFLAGS) -o$@ $<
-
-gengtype-yacc.c gengtype-yacc.h: gengtype-yacc.y
-       -$(BISON) $(BISONFLAGS) -d -o gengtype-yacc.c $<
-
-build/genconditions$(build_exeext) : build/genconditions.o \
-  $(BUILD_EARLY_SUPPORT) $(BUILD_RTL) $(BUILD_ERRORS) $(BUILD_LIBDEPS)
-       $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
-        build/genconditions.o $(BUILD_EARLY_SUPPORT) $(BUILD_RTL) \
-        $(BUILD_ERRORS) $(BUILD_LIBS)
-
-build/genconditions.o : genconditions.c $(RTL_BASE_H) $(BCONFIG_H) \
-  $(SYSTEM_H) coretypes.h $(GTM_H) errors.h
-
-build/errors.o : errors.c $(BCONFIG_H) $(SYSTEM_H) errors.h
-build/ggc-none.o : ggc-none.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GGC_H)
-build/min-insn-modes.o : min-insn-modes.c $(BCONFIG_H) $(SYSTEM_H) \
-  $(MACHMODE_H)
-build/rtl.o: rtl.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) $(RTL_H) \
-  real.h $(GGC_H) errors.h
-build/print-rtl.o: print-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) \
-  $(RTL_BASE_H)
-build/varray.o: varray.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) \
-  $(VARRAY_H) $(RTL_BASE_H) $(GGC_H) $(TREE_H) bitmap.h errors.h
+# This is a pattern rule solely so that Make knows it need not run the
+# command twice.  The modifier to $@ ensures that Bison is asked to
+# produce a .c file, whether or not Make decides it needs the .h file
+# first.
+gengtype-y%.c gengtype-y%.h: gengtype-y%.y
+       -$(BISON) $(BISONFLAGS) -d -o $(@:.h=.c) $<
 
 #\f
 # Remake internationalization support.
@@ -3208,7 +3071,7 @@ test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
 # gcov-iov.c is run on the build machine to generate gcov-iov.h from version.c
 build/gcov-iov.o: gcov-iov.c $(BCONFIG_H) coretypes.h $(GTM_H) \
   $(SYSTEM_H) coretypes.h $(TM_H)
+
 build/gcov-iov$(build_exeext): build/gcov-iov.o
        $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) build/gcov-iov.o -o $@