view src/Makefile.in.in @ 2720:6fa9919a9a0b

[xemacs-hg @ 2005-04-08 23:10:01 by crestani] ChangeLog addition: 2005-04-01  Marcus Crestani  <crestani@xemacs.org>         The new allocator.         New configure flag: `MC_ALLOC':         * configure.ac (XE_COMPLEX_ARG_ENABLE): Add `--enable-mc-alloc' as         a new configure flag.         * configure.in (AC_INIT_PARSE_ARGS): Add `--mc-alloc' as a new         configure flag.         * configure.usage: Add description for `mc-alloc'.         DUMP_IN_EXEC:         * Makefile.in.in: Condition the installation of a separate dump         file on !DUMP_ON_EXEC.         * configure.ac (XE_COMPLEX_ARG_ENABLE): Add         `--enable-dump-in-exec' as a new configure flag.         * configure.ac: DUMP_IN_EXEC is define as default for PDUMP but         not default for MC_ALLOC.         * configure.in (AC_INIT_PARSE_ARGS): Add `--dump-in-exec' as a         new configure flag.         * configure.in: DUMP_IN_EXEC is define as default for PDUMP but         not default for MC_ALLOC.         * configure.usage: Add description for `dump-in-exec'. lib-src/ChangeLog addition: 2005-04-01  Marcus Crestani  <crestani@xemacs.org>         The new allocator.         DUMP_IN_EXEC:                  * Makefile.in.in: Only compile insert-data-in-exec if         DUMP_IN_EXEC is defined. lisp/ChangeLog addition: 2005-04-01  Marcus Crestani  <crestani@xemacs.org>         The new allocator.         MEMORY_USAGE_STATS         * diagnose.el: Add new lisp function to pretty print statistics         about the new allocator.         * diagnose.el (show-mc-alloc-memory-usage): New. modules/ChangeLog addition: 2005-04-01  Marcus Crestani  <crestani@xemacs.org>         The new allocator.         Remove Lcrecords:                  * postgresql/postgresql.c (allocate_pgconn): Allocate with new         allocator.         * postgresql/postgresql.c (allocate_pgresult): Allocate PGresult         with new allocator.           * postgresql/postgresql.h (struct Lisp_PGconn): Add         lrecord_header.         * postgresql/postgresql.h (struct Lisp_PGresult): Add         lrecord_header.         * ldap/eldap.c (allocate_ldap): Allocate with new allocator.         * ldap/eldap.h (struct Lisp_LDAP): Add lrecord_header. nt/ChangeLog addition: 2005-04-01  Marcus Crestani  <crestani@xemacs.org>         The new allocator.         New configure flag: `MC_ALLOC':         * config.inc.samp: Add new flag `MC_ALLOC'.         * xemacs.mak: Add flag and configuration output for `MC_ALLOC'.         New files:         * xemacs.dsp: Add source files mc-alloc.c and mc-alloc.h.         * xemacs.mak: Add new object file mc-alloc.obj to dependencies. src/ChangeLog addition: 2005-04-01  Marcus Crestani  <crestani@xemacs.org>         The new allocator.         New configure flag: `MC_ALLOC':         * config.h.in: Add new flag `MC_ALLOC'.         New files:         * Makefile.in.in: Add new object file mc-alloc.o.         * depend: Add new files to dependencies.         * mc-alloc.c: New.         * mc-alloc.h: New.         Running the new allocator from XEmacs:         * alloc.c (deadbeef_memory): Moved to mc-alloc.c.         * emacs.c (main_1): Initialize the new allocator and add         syms_of_mc_alloc.         * symsinit.h: Add syms_of_mc_alloc.         New lrecord allocation and free functions:         * alloc.c (alloc_lrecord): New. Allocates an lrecord, includes         type checking and initializing of the lrecord_header.         * alloc.c (noseeum_alloc_lrecord): Same as above, but increments         the NOSEEUM cons counter.         * alloc.c (free_lrecord): New. Calls the finalizer and frees the         lrecord.         * lrecord.h: Add lrecord allocation prototypes and comments.         Remove old lrecord FROB block allocation:                  * alloc.c (allocate_lisp_storage): Former function to expand         heap. Not needed anymore, remove.         * alloc.c: Completely remove `Fixed-size type macros'         * alloc.c (release_breathing_space): Remove.         * alloc.c (memory_full): Remove release_breathing_space.         * alloc.c (refill_memory_reserve): Remove.         * alloc.c (TYPE_ALLOC_SIZE): Remove.         * alloc.c (DECLARE_FIXED_TYPE_ALLOC): Remove.         * alloc.c (ALLOCATE_FIXED_TYPE_FROM_BLOCK): Remove.         * alloc.c (ALLOCATE_FIXED_TYPE_1): Remove.         * alloc.c (ALLOCATE_FIXED_TYPE): Remove.         * alloc.c (NOSEEUM_ALLOCATE_FIXED_TYPE): Remove.         * alloc.c (struct Lisp_Free): Remove.         * alloc.c (LRECORD_FREE_P): Remove.         * alloc.c (MARK_LRECORD_AS_FREE): Remove.         * alloc.c (MARK_LRECORD_AS_NOT_FREE): Remove.         * alloc.c (PUT_FIXED_TYPE_ON_FREE_LIST): Remove.         * alloc.c (FREE_FIXED_TYPE): Remove.         * alloc.c (FREE_FIXED_TYPE_WHEN_NOT_IN_GC): Remove.         Allocate old lrecords with new allocator:                  * alloc.c: DECLARE_FIXED_TYPE_ALLOC removed for all lrecords         defined in alloc.c.         * alloc.c (Fcons): Allocate with new allocator.         * alloc.c (noseeum_cons): Allocate with new allocator.         * alloc.c (make_float): Allocate with new allocator.         * alloc.c (make_bignum): Allocate with new allocator.         * alloc.c (make_bignum_bg): Allocate with new allocator.         * alloc.c (make_ratio): Allocate with new allocator.         * alloc.c (make_ratio_bg): Allocate with new allocator.         * alloc.c (make_ratio_rt): Allocate with new allocator.         * alloc.c (make_bigfloat): Allocate with new allocator.         * alloc.c (make_bigfloat_bf): Allocate with new allocator.         * alloc.c (make_compiled_function): Allocate with new allocator.         * alloc.c (Fmake_symbol): Allocate with new allocator.         * alloc.c (allocate_extent): Allocate with new allocator.         * alloc.c (allocate_event): Allocate with new allocator.         * alloc.c (make_key_data): Allocate with new allocator.         * alloc.c (make_button_data): Allocate with new allocator.         * alloc.c (make_motion_data): Allocate with new allocator.         * alloc.c (make_process_data): Allocate with new allocator.         * alloc.c (make_timeout_data): Allocate with new allocator.         * alloc.c (make_magic_data): Allocate with new allocator.         * alloc.c (make_magic_eval_data): Allocate with new allocator.         * alloc.c (make_eval_data): Allocate with new allocator.         * alloc.c (make_misc_user_data): Allocate with new allocator.         * alloc.c (Fmake_marker): Allocate with new allocator.         * alloc.c (noseeum_make_marker): Allocate with new allocator.         * alloc.c (make_uninit_string): Allocate with new allocator.         * alloc.c (resize_string): Allocate with new allocator.         * alloc.c (make_string_nocopy): Allocate with new allocator.         Garbage Collection:         * alloc.c (GC_CHECK_NOT_FREE): Remove obsolete assertions.         * alloc.c (SWEEP_FIXED_TYPE_BLOCK): Remove.         * alloc.c (SWEEP_FIXED_TYPE_BLOCK_1): Remove.         * alloc.c (sweep_conses): Remove.         * alloc.c (free_cons): Use new allocator to free.         * alloc.c (sweep_compiled_functions): Remove.         * alloc.c (sweep_floats): Remove.         * alloc.c (sweep_bignums): Remove.         * alloc.c (sweep_ratios): Remove.         * alloc.c (sweep_bigfloats): Remove.         * alloc.c (sweep_symbols): Remove.         * alloc.c (sweep_extents): Remove.         * alloc.c (sweep_events): Remove.         * alloc.c (sweep_key_data): Remove.         * alloc.c (free_key_data): Use new allocator to free.         * alloc.c (sweep_button_data): Remove.         * alloc.c (free_button_data): Use new allocator to free.         * alloc.c (sweep_motion_data): Remove.         * alloc.c (free_motion_data): Use new allocator to free.         * alloc.c (sweep_process_data): Remove.         * alloc.c (free_process_data): Use new allocator to free.         * alloc.c (sweep_timeout_data): Remove.         * alloc.c (free_timeout_data): Use new allocator to free.         * alloc.c (sweep_magic_data): Remove.         * alloc.c (free_magic_data): Use new allocator to free.         * alloc.c (sweep_magic_eval_data): Remove.         * alloc.c (free_magic_eval_data): Use new allocator to free.         * alloc.c (sweep_eval_data): Remove.         * alloc.c (free_eval_data): Use new allocator to free.         * alloc.c (sweep_misc_user_data): Remove.         * alloc.c (free_misc_user_data): Use new allocator to free.         * alloc.c (sweep_markers): Remove.         * alloc.c (free_marker): Use new allocator to free.         * alloc.c (garbage_collect_1): Remove release_breathing_space.         * alloc.c (gc_sweep): Remove all the old lcrecord and lrecord         related stuff. Sweeping now works like this: compact string         chars, finalize, sweep.         * alloc.c (common_init_alloc_early): Remove old lrecord         initializations, remove breathing_space.         * emacs.c (Fdump_emacs): Remove release_breathing_space.         * lisp.h: Remove prototype for release_breathing_space.         * lisp.h: Adjust the special cons mark makros.         Lrecord Finalizer:         * alloc.c: Add finalizer to lrecord definition.         * alloc.c (finalize_string): Add finalizer for string.         * bytecode.c: Add finalizer to lrecord definition.         * bytecode.c (finalize_compiled_function): Add finalizer for         compiled function.         * marker.c: Add finalizer to lrecord definition.         * marker.c (finalize_marker): Add finalizer for marker.         These changes build the interface to mc-alloc:         * lrecord.h (MC_ALLOC_CALL_FINALIZER): Tell mc-alloc how to         finalize lrecords.         * lrecord.h (MC_ALLOC_CALL_FINALIZER_FOR_DISKSAVE): Tell         mc-alloc how to finalize for disksave.         Unify lrecords and lcrecords:         * lisp.h (struct Lisp_String): Adjust string union hack to         new lrecord header.         * lrecord.h: Adjust comments.         * lrecord.h (struct lrecord_header): The new lrecord header         includes type, lisp-readonly, free, and uid.         * lrecord.h (set_lheader_implementation): Adjust to new         lrecord_header.         * lrecord.h (struct lrecord_implementation): The field basic_p         for indication of an old lrecord is not needed anymore, remove.         * lrecord.h (MAKE_LRECORD_IMPLEMENTATION): Remove basic_p.         * lrecord.h (MAKE_EXTERNAL_LRECORD_IMPLEMENTATION): Remove         basic_p.         * lrecord.h (copy_sized_lrecord): Remove distinction between         old lrecords and lcrecords.         * lrecord.h (copy_lrecord): Remove distinction between old         lrecords and lcrecords.         * lrecord.h (zero_sized_lrecord): Remove distinction between         old lrecords and lcrecords.         * lrecord.h (zero_lrecord): Remove distinction between old         lrecords and lcrecords.         Remove lcrecords and lcrecord lists:         * alloc.c (basic_alloc_lcrecord): Not needed anymore, remove.         * alloc.c (very_old_free_lcrecord): Not needed anymore, remove.         * alloc.c (copy_lisp_object): No more distinction between         lrecords and lcrecords.         * alloc.c (all_lcrecords): Not needed anymore, remove.         * alloc.c (make_vector_internal): Allocate as lrecord.         * alloc.c (make_bit_vector_internal): Allocate as lrecord.         * alloc.c: Completely remove `lcrecord lists'.         * alloc.c (free_description): Remove.         * alloc.c (lcrecord_list_description): Remove.         * alloc.c (mark_lcrecord_list): Remove.         * alloc.c (make_lcrecord_list): Remove.         * alloc.c (alloc_managed_lcrecord): Remove.         * alloc.c (free_managed_lcrecord): Remove.         * alloc.c (alloc_automanaged_lcrecord): Remove.         * alloc.c (free_lcrecord): Remove.         * alloc.c (lcrecord_stats): Remove.         * alloc.c (tick_lcrecord_stats): Remove.         * alloc.c (disksave_object_finalization_1): Add call to         mc_finalize_for_disksave. Remove the lcrecord way to visit all         objects.         * alloc.c (kkcc_marking): Remove XD_FLAG_FREE_LISP_OBJECT         * alloc.c (sweep_lcrecords_1): Remove.         * alloc.c (common_init_alloc_early): Remove everything related         to lcrecords, remove old lrecord initializations,         * alloc.c (init_lcrecord_lists): Not needed anymore, remove.         * alloc.c (reinit_alloc_early): Remove everything related to         lcrecords.         * alloc.c (init_alloc_once_early): Remove everything related to         lcrecords.         * buffer.c (allocate_buffer): Allocate as lrecord.         * buffer.c (nuke_all_buffer_slots): Use lrecord functions.         * buffer.c (common_init_complex_vars_of_buffer): Allocate as         lrecord.         * buffer.h (struct buffer): Add lrecord_header.         * casetab.c (allocate_case_table): Allocate as lrecord.         * casetab.h (struct Lisp_Case_Table): Add lrecord_header.         * charset.h (struct Lisp_Charset): Add lrecord_header.         * chartab.c (fill_char_table): Use lrecord functions.         * chartab.c (Fmake_char_table): Allocate as lrecord.         * chartab.c (make_char_table_entry): Allocate as lrecord.         * chartab.c (copy_char_table_entry): Allocate as lrecord.         * chartab.c (Fcopy_char_table): Allocate as lrecord.         * chartab.c (put_char_table): Use lrecord functions.         * chartab.h (struct Lisp_Char_Table_Entry): Add lrecord_header.         * chartab.h (struct Lisp_Char_Table): Add lrecord_header.         * console-impl.h (struct console): Add lrecord_header.         * console-msw-impl.h (struct Lisp_Devmode): Add lrecord_header.         * console-msw-impl.h (struct mswindows_dialog_id): Add         lrecord_header.         * console.c (allocate_console): Allocate as lrecord.         * console.c (nuke_all_console_slots): Use lrecord functions.         * console.c (common_init_complex_vars_of_console): Allocate as         lrecord.         * data.c (make_weak_list): Allocate as lrecord.         * data.c (make_weak_box): Allocate as lrecord.         * data.c (make_ephemeron): Allocate as lrecord.         * database.c (struct Lisp_Database): Add lrecord_header.         * database.c (allocate_database): Allocate as lrecord.         * device-impl.h (struct device): Add lrecord_header.         * device-msw.c (allocate_devmode): Allocate as lrecord.         * device.c (nuke_all_device_slots): Use lrecord functions.         * device.c (allocate_device): Allocate as lrecord.         * dialog-msw.c (handle_question_dialog_box): Allocate as lrecord.         * elhash.c (struct Lisp_Hash_Table): Add lrecord_header.         * elhash.c (make_general_lisp_hash_table): Allocate as lrecord.         * elhash.c (Fcopy_hash_table): Allocate as lrecord.         * event-stream.c: Lcrecord lists Vcommand_builder_free_list and         Vtimeout_free_list are no longer needed. Remove.         * event-stream.c (allocate_command_builder): Allocate as lrecord.         * event-stream.c (free_command_builder): Use lrecord functions.         * event-stream.c (event_stream_generate_wakeup): Allocate as         lrecord.         * event-stream.c (event_stream_resignal_wakeup): Use lrecord         functions.         * event-stream.c (event_stream_disable_wakeup): Use lrecord         functions.         * event-stream.c (reinit_vars_of_event_stream): Lcrecord lists         remove.         * events.h (struct Lisp_Timeout): Add lrecord_header.         * events.h (struct command_builder): Add lrecord_header.         * extents-impl.h (struct extent_auxiliary): Add lrecord_header.         * extents-impl.h (struct extent_info): Add lrecord_header.         * extents.c (allocate_extent_auxiliary): Allocate as lrecord.         * extents.c (allocate_extent_info): Allocate as lrecord.         * extents.c (copy_extent): Allocate as lrecord.         * faces.c (allocate_face): Allocate as lrecord.         * faces.h (struct Lisp_Face): Add lrecord_header.         * file-coding.c (allocate_coding_system): Allocate as lrecord.         * file-coding.c (Fcopy_coding_system): Allocate as lrecord.         * file-coding.h (struct Lisp_Coding_System): Add lrecord_header.         * fns.c (Ffillarray): Allocate as lrecord.         * frame-impl.h (struct frame): Add lrecord_header.         * frame.c (nuke_all_frame_slots): Use lrecord functions.         * frame.c (allocate_frame_core): Allocate as lrecord.         * glyphs.c (allocate_image_instance): Allocate as lrecord.         * glyphs.c (Fcolorize_image_instance): Allocate as lrecord.         * glyphs.c (allocate_glyph): Allocate as lrecord.         * glyphs.h (struct Lisp_Image_Instance): Add lrecord_header.         * glyphs.h (struct Lisp_Glyph): Add lrecord_header.         * gui.c (allocate_gui_item): Allocate as lrecord.         * gui.h (struct Lisp_Gui_Item): Add lrecord_header.         * keymap.c (struct Lisp_Keymap): Add lrecord_header.         * keymap.c (make_keymap): Allocate as lrecord.         * lisp.h (struct Lisp_Vector): Add lrecord_header.         * lisp.h (struct Lisp_Bit_Vector): Add lrecord_header.         * lisp.h (struct weak_box): Add lrecord_header.         * lisp.h (struct ephemeron): Add lrecord_header.         * lisp.h (struct weak_list): Add lrecord_header.         * lrecord.h (struct lcrecord_header): Not used, remove.         * lrecord.h (struct free_lcrecord_header): Not used, remove.         * lrecord.h (struct lcrecord_list): Not needed anymore, remove.         * lrecord.h (lcrecord_list): Not needed anymore, remove.         * lrecord.h: (enum data_description_entry_flags): Remove         XD_FLAG_FREE_LISP_OBJECT.         * lstream.c: Lrecord list Vlstream_free_list remove.         * lstream.c (Lstream_new): Allocate as lrecord.         * lstream.c (Lstream_delete): Use lrecod functions.         * lstream.c (reinit_vars_of_lstream): Vlstream_free_list         initialization remove.           * lstream.h (struct lstream): Add lrecord_header.         * emacs.c (main_1): Remove lstream initialization.         * mule-charset.c (make_charset): Allocate as lrecord.         * objects-impl.h (struct Lisp_Color_Instance): Add         lrecord_header.         * objects-impl.h (struct Lisp_Font_Instance): Add lrecord_header.         * objects.c (Fmake_color_instance): Allocate as lrecord.         * objects.c (Fmake_font_instance): Allocate as lrecord.         * objects.c (reinit_vars_of_objects): Allocate as lrecord.         * opaque.c: Lcreord list Vopaque_ptr_list remove.         * opaque.c (make_opaque): Allocate as lrecord.         * opaque.c (make_opaque_ptr): Allocate as lrecord.         * opaque.c (free_opaque_ptr): Use lrecord functions.         * opaque.c (reinit_opaque_early):         * opaque.c (init_opaque_once_early): Vopaque_ptr_list         initialization remove.         * opaque.h (Lisp_Opaque): Add lrecord_header.         * opaque.h (Lisp_Opaque_Ptr): Add lrecord_header.         * emacs.c (main_1): Remove opaque variable initialization.         * print.c (default_object_printer): Use new lrecord_header.         * print.c (print_internal): Use new lrecord_header.         * print.c (debug_p4): Use new lrecord_header.         * process.c (make_process_internal): Allocate as lrecord.         * procimpl.h (struct Lisp_Process): Add lrecord_header.         * rangetab.c (Fmake_range_table): Allocate as lrecord.         * rangetab.c (Fcopy_range_table): Allocate as lrecord.         * rangetab.h (struct Lisp_Range_Table): Add lrecord_header.         * scrollbar.c (create_scrollbar_instance): Allocate as lrecord.         * scrollbar.h (struct scrollbar_instance): Add lrecord_header.         * specifier.c (make_specifier_internal): Allocate as lrecord.         * specifier.h (struct Lisp_Specifier): Add lrecord_header.         * symbols.c:         * symbols.c (Fmake_variable_buffer_local): Allocate as lrecord.         * symbols.c (Fdontusethis_set_symbol_value_handler): Allocate         as lrecord.         * symbols.c (Fdefvaralias): Allocate as lrecord.         * symeval.h (struct symbol_value_magic): Add lrecord_header.         * toolbar.c (update_toolbar_button): Allocate as lrecord.         * toolbar.h (struct toolbar_button): Add lrecord_header.         * tooltalk.c (struct Lisp_Tooltalk_Message): Add lrecord_header.         * tooltalk.c (make_tooltalk_message): Allocate as lrecord.         * tooltalk.c (struct Lisp_Tooltalk_Pattern): Add lrecord_header.         * tooltalk.c (make_tooltalk_pattern): Allocate as lrecord.         * ui-gtk.c (allocate_ffi_data): Allocate as lrecord.         * ui-gtk.c (allocate_emacs_gtk_object_data): Allocate as lrecord.         * ui-gtk.c (allocate_emacs_gtk_boxed_data): Allocate as lrecord.         * ui-gtk.h (structs): Add lrecord_header.         * window-impl.h (struct window): Add lrecord_header.         * window-impl.h (struct window_mirror): Add lrecord_header.         * window.c (allocate_window): Allocate as lrecord.         * window.c (new_window_mirror): Allocate as lrecord.         * window.c (make_dummy_parent): Allocate as lrecord.         MEMORY_USAGE_STATS         * alloc.c (fixed_type_block_overhead): Not used anymore, remove.         * buffer.c (compute_buffer_usage): Get storage size from new         allocator.         * marker.c (compute_buffer_marker_usage): Get storage size from         new allocator.         * mule-charset.c (compute_charset_usage): Get storage size from         new allocator.         * scrollbar-gtk.c (gtk_compute_scrollbar_instance_usage): Get         storage size from new allocator.         * scrollbar-msw.c (mswindows_compute_scrollbar_instance_usage):         Get storage size from new allocator.         * scrollbar-x.c (x_compute_scrollbar_instance_usage): Get         storage size from new allocator.         * scrollbar.c (compute_scrollbar_instance_usage): Get storage         size from new allocator.         * unicode.c (compute_from_unicode_table_size_1): Get storage         size from new allocator.         * unicode.c (compute_to_unicode_table_size_1): Get storage size         from new allocator.         * window.c (compute_window_mirror_usage): Get storage size from         new allocator.         * window.c (compute_window_usage): Get storage size from new         allocator.         MC_ALLOC_TYPE_STATS:         * alloc.c (alloc_lrecord): Bump lrecord count.         * alloc.c (noseeum_alloc_lrecord): Bump lrecord count.         * alloc.c (struct lrecord_stats): Storage for counts.         * alloc.c (init_lrecord_stats): Zero statistics.         * alloc.c (inc_lrecord_stats): Increase the statistic.         * alloc.c (dec_lrecord_stats): Decrease the statistic.         * alloc.c (gc_plist_hack): Used to print the information.         * alloc.c (Fgarbage_collect): Return the collected information.         * mc-alloc.c (remove_cell): Decrease lrecord count.         * mc-alloc.h: Set flag MC_ALLOC_TYPE_STATS.         * emacs.c (main_1): Init lrecord statistics.         * lrecord.h: Add prototypes for *_lrecord_stats.         Strings:         * alloc.c (Fmake_string): Initialize ascii_begin to zero.         * alloc.c (gc_count_num_short_string_in_use): Remove.         * alloc.c (gc_count_string_total_size): Remove.         * alloc.c (gc_count_short_string_total_size): Remove.         * alloc.c (debug_string_purity): Remove.         * alloc.c (debug_string_purity_print): Remove.         * alloc.c (sweep_strings): Remove.                  Remove static C-readonly Lisp objects:         * alloc.c (c_readonly): Not needed anymore, remove.         * alloc.c (GC_CHECK_LHEADER_INVARIANTS): Remove some obsolete         lheader invariants assertions.         * buffer.c (DEFVAR_BUFFER_LOCAL_1): Allocate dynamically.         * console.c (DEFVAR_CONSOLE_LOCAL_1): Allocate dynamically.         * gpmevent.c: Indirection via MC_ALLOC_Freceive_gpm_event.         * gpmevent.c (Fgpm_enable): Allocate dynamically.         * gpmevent.c (syms_of_gpmevent): Allocate dynamically.         * lisp.h (C_READONLY): Not needed anymore, remove.         * lisp.h (DEFUN): Allocate dynamically.         * lrecord.h (C_READONLY_RECORD_HEADER_P): Not needed anymore,         remove.         * lrecord.h (SET_C_READONLY_RECORD_HEADER): Not needed anymore,         remove.         * symbols.c (guts_of_unbound_marker):         * symeval.h (defsubr): Allocate dynamically.         * symeval.h (DEFSUBR_MACRO): Allocate dynamically.         * symeval.h (DEFVAR_ SYMVAL_FWD): Allocate dynamically.         * tests.c (TESTS_DEFSUBR): Allocate dynamically.         Definition of mcpro:         * lisp.h: Add mcpro prototypes.         * alloc.c (common_init_alloc_early): Add initialization for         mcpros.         * alloc.c (mcpro_description_1): New.         * alloc.c (mcpro_description): New.         * alloc.c (mcpros_description_1): New.         * alloc.c (mcpros_description): New.         * alloc.c (mcpro_one_name_description_1): New.         * alloc.c (mcpro_one_name_description): New.         * alloc.c (mcpro_names_description_1): New.         * alloc.c (mcpro_names_description): New.         * alloc.c (mcpros): New.         * alloc.c (mcpro_names): New.         * alloc.c (mcpro_1): New.         * alloc.c (mc_pro): New.         * alloc.c (garbage_collect_1): Add mcpros to root set.         Usage of mcpro:         * alloc.c (make_string_nocopy): Add string to root set.         * symbols.c (init_symbols_once_early): Add Qunbound to root set.         Changes to the Portable Dumper:                  * alloc.c (FREE_OR_REALLOC_BEGIN): Since dumped objects can be         freed with the new allocator, remove assertion for !DUMPEDP.         * dumper.c: Adjust comments, increase PDUMP_HASHSIZE.         * dumper.c (pdump_make_hash): Shift address only 2 bytes, to         avoid collisions.         * dumper.c (pdump_objects_unmark): No more mark bits within         the object, remove.         * dumper.c (mc_addr_elt): New. Element data structure for mc         hash table.         * dumper.c (pdump_mc_hash): New hash table: `lookup table'.         * dumper.c (pdump_get_mc_addr): New. Lookup for hash table.         * dumper.c (pdump_get_indirect_mc_addr): New. Lookup for         convertibles.         * dumper.c (pdump_put_mc_addr): New. Putter for hash table.         * dumper.c (pdump_dump_mc_data): New. Writes the table for         relocation at load time to the dump file.         * dumper.c (pdump_scan_lisp_objects_by_alignment): New.         Visits all dumped Lisp objects.         * dumper.c (pdump_scan_non_lisp_objects_by_alignment): New.         Visits all other dumped objects.         * dumper.c (pdump_reloc_one_mc): New. Updates all pointers         of an object by using the hash table pdump_mc_hash.         * dumper.c (pdump_reloc_one): Replaced by pdump_reloc_one_mc.         * dumper.c (pdump): Change the structure of the dump file, add         the mc post dump relocation table to dump file.         * dumper.c (pdump_load_finish): Hand all dumped objects to the         new allocator and use the mc post dump relocation table for         relocating the dumped objects at dump file load time, free not         longer used data structures.         * dumper.c (pdump_load): Free the dump file.         * dumper.h: Remove pdump_objects_unmark.         * lrecord.h (DUMPEDP): Dumped objects can be freed, remove.              DUMP_IN_EXEC:         * Makefile.in.in: Linking for and with dump in executable only if         DUMP_IN_EXEC is defined.         * config.h.in: Add new flag `DUMP_IN_EXEC'         * emacs.c: Condition dump-data.h on DUMP_IN_EXEC.         * emacs.c (main_1): Flag `-si' only works if dump image is         written into executable.         Miscellanious         * lrecord.h (enum lrecord_type): Added numbers to all types,         very handy for debugging.         * xemacs.def.in.in: Add mc-alloc functions to make them visible         to the modules.
author crestani
date Fri, 08 Apr 2005 23:11:35 +0000
parents 0b4097b3552f
children 9e04ad6a1ac6
line wrap: on
line source

##   Makefile for src subdirectory in XEmacs.
##   Copyright (C) 1985, 1987, 1988, 1993, 1994 Free Software Foundation, Inc.
##   Copyright (C) 1994, 1995 Board of Trustees, University of Illinois
##   Copyright (C) 1996, 1997 Sun Microsystems, Inc.
##   Copyright (C) 1998, 1999 J. Kean Johnston.
##   Copyright (C) 2001, 2002, 2003 Ben Wing.

## This file is part of XEmacs.

## XEmacs is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 2, or (at your option) any
## later version.

## XEmacs is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
## for more details.

## You should have received a copy of the GNU General Public License
## along with XEmacs; see the file COPYING.  If not, write to
## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
## Boston, MA 02111-1307, USA.

## Synched up with: Not synched with FSF.

.PHONY: all
all: build-the-mofo

#define NOT_C_CODE
#include "config.h"

## Here are the things that we expect ../configure to edit.

#ifdef USE_GNU_MAKE
RECURSIVE_MAKE_ARGS=
#else
@SET_MAKE@
RECURSIVE_MAKE_ARGS=@RECURSIVE_MAKE_ARGS@
#endif

PROGNAME=@PROGNAME@
prefix=@prefix@
SRC=@srcdir@
blddir=@blddir@
version=@version@
CC=@XEMACS_CC@
CPP=@CPP@
CFLAGS=@XE_CFLAGS@
CPPFLAGS=@CPPFLAGS@
LDFLAGS=@LDFLAGS@

c_switch_all=@c_switch_all@
ld_switch_all=@ld_switch_all@
ld_libs_all=@ld_libs_all@
ld_dynamic_link_flags=@ld_dynamic_link_flags@

extra_objs=@extra_objs@
LN_S=@LN_S@

ld_switch_shared=@ld_switch_shared@
start_files=@start_files@
start_flags=@start_flags@
LD=@ld@
lib_gcc=@lib_gcc@
##libmcheck=@libmcheck@


## With the traditional VPATH setting, it is not possible to
## simultaneously compile in-place and in another directory.  The
## mistaken definition is that *all* dependencies are searched for in
## the VPATH directory, rather than just the dependencies that are not
## themselves targets.  Thus, if there is an up-to-date .o file in the
## in-place location, it will not get recompiled in the not-in-place
## location.

## The GNU Make "vpath" directive continues this tradition, but at
## least lets you restrict the classes of files that it applies to.
## This allows us to kludge around the problem.

#ifdef USE_GNU_MAKE
vpath %.c @srcdir@
vpath %.h @srcdir@
## now list files that should NOT be searched in the srcdir.
## This includes any .c or .h built from something else
## (e.g. a .in file).
vpath config.h
vpath paths.h
vpath Emacs.ad.h
vpath sheap-adjust.h
vpath dump-id.c
#else
VPATH=@srcdir@
#endif

SHELL=/bin/sh
RM = rm -f

LISP = $(SRC)/../lisp
ETC = $(SRC)/../etc
SRCMODULES = $(SRC)/../modules
LIB_SRC = ../lib-src
BLDSRC = .
BLDMODULES = ../modules
LWLIB_SRCDIR = $(SRC)/../lwlib

#########################################################################
##         Definitions of object files and other dependencies          ##
#########################################################################

## NOTE: Some of the object files are specified in this file, and others in
## configure.in.  The general rule is that they be specified here whenever
## possible -- in practice, that means that they have clear dependencies on
## configure defines.  They should be in configure.in when there is no
## configure define or when there is extremely hairy code to determine
## which files are needed (e.g. native sound support) and it would be
## pointless to duplicate that code.

gui_objs= gui.o
#ifdef HAVE_MENUBARS
gui_objs += menubar.o
#endif
#ifdef HAVE_SCROLLBARS
gui_objs += scrollbar.o
#endif
#ifdef HAVE_DIALOGS
gui_objs += dialog.o
#endif
#ifdef HAVE_TOOLBARS
gui_objs += toolbar.o
#endif

#ifdef HAVE_X_WINDOWS
x_objs=console-x.o device-x.o event-Xt.o frame-x.o \
 glyphs-x.o objects-x.o redisplay-x.o select-x.o xgccache.o intl-x.o
x_gui_objs=$(gui_objs:.o=-x.o)
#ifdef HAVE_TOOLBARS
x_gui_objs += toolbar-common.o
#endif
#endif

#ifdef HAVE_MS_WINDOWS
mswindows_objs=console-msw.o device-msw.o event-msw.o frame-msw.o \
  objects-msw.o select-msw.o redisplay-msw.o glyphs-msw.o
mswindows_gui_objs=$(gui_objs:.o=-msw.o)
#endif

#ifdef HAVE_TTY
tty_objs=console-tty.o device-tty.o event-tty.o frame-tty.o objects-tty.o \
 redisplay-tty.o cm.o
#endif

#ifdef HAVE_GTK
gtk_objs=console-gtk.o device-gtk.o event-gtk.o frame-gtk.o \
 objects-gtk.o redisplay-gtk.o glyphs-gtk.o select-gtk.o gccache-gtk.o \
 gtk-xemacs.o ui-gtk.o
gtk_gui_objs=$(gui_objs:.o=-gtk.o)
#ifdef HAVE_TOOLBARS
gtk_gui_objs += toolbar-common.o
#endif
#endif

#ifdef HAVE_BALLOON_HELP
balloon_help_objs=balloon_help.o balloon-x.o
#endif

#ifdef CLASH_DETECTION
clash_detection_objs=filelock.o
#endif

#ifdef HAVE_DATABASE
database_objs=database.o
#endif

#ifdef DEBUG_XEMACS
debug_objs=debug.o tests.o
#endif

#ifdef HAVE_UNIXOID_EVENT_LOOP
event_unixoid_objs=event-unixoid.o
#endif

#ifdef HAVE_GIF
gif_objs=dgif_lib.o gif_io.o
#endif

#ifdef HAVE_GPM
gpm_objs=gpmevent.o
#endif

#if defined(HAVE_LDAP) && !defined(HAVE_SHLIB)
ldap_objs=$(BLDMODULES)/ldap/eldap.o
#endif

#ifdef MULE
mule_objs=mule-ccl.o mule-charset.o mule-coding.o
#endif

#ifdef HAVE_CANNA
mule_canna_objs=mule-canna.o
#endif

#ifdef HAVE_WNN
mule_wnn_objs=mule-wnnfns.o
#endif

#ifdef WITH_GMP
number_objs=number-gmp.o number.o
#endif
#ifdef WITH_MP
number_objs=number-mp.o number.o
#endif

#if defined(HAVE_POSTGRESQL) && !defined(HAVE_SHLIB)
postgresql_objs=$(BLDMODULES)/postgresql/postgresql.o
#endif

#ifdef HAVE_WIN32_PROCESSES
process_objs=process-nt.o
#elif defined (HAVE_UNIX_PROCESSES)
process_objs=process-unix.o
#endif

#ifdef HAVE_SETITIMER
profile_objs=profile.o
#endif

#if defined (HEAP_IN_DATA) && !defined (PDUMP)
sheap_objs=sheap.o
#endif

#ifdef HAVE_SHLIB
shlib_objs=sysdll.o
# ifdef HAVE_MS_WINDOWS
export_lib=xemacs-export.o
xemacs-export.o: xemacs.def
	dlltool -D xemacs-${version}.exe -d $< -l xemacs-import.a -e $@
# endif
#endif

#ifdef SUNPRO
sunpro_objs=sunpro.o
#endif

#ifdef TOOLTALK
tooltalk_objs=tooltalk.o
#endif

#if defined (WIN32_NATIVE) || defined (CYGWIN)
win32_objs=win32.o intl-win32.o intl-auto-encap-win32.o intl-encap-win32.o \
 xemacs_res.o
#endif

#ifdef MC_ALLOC
mc_alloc_objs=mc-alloc.o
#endif

## lastfile must follow all files whose initialized data areas should
## be dumped as pure by dump-emacs.

## NOTE: The last line cannot be all macros, because make will barf
## if they all come out null.

objs=\
 abbrev.o alloc.o alloca.o \
 $(balloon_help_objs) blocktype.o buffer.o bytecode.o \
 callint.o casefiddle.o casetab.o chartab.o \
 $(clash_detection_objs) cmdloop.o cmds.o $(coding_system_objs) console.o \
 console-stream.o\
 data.o $(database_objs) $(debug_objs) device.o dired.o doc.o doprnt.o\
 dynarr.o \
 editfns.o elhash.o emacs.o emodules.o eval.o events.o\
 event-stream.o $(event_unixoid_objs) $(extra_objs) extents.o\
 faces.o file-coding.o fileio.o $(LOCK_OBJ) filemode.o floatfns.o fns.o \
 font-lock.o frame.o\
 general.o $(gif_objs) glyphs.o glyphs-eimage.o glyphs-shared.o\
 glyphs-widget.o $(gpm_objs) $(gtk_objs) $(gtk_gui_objs) $(gui_objs) \
 gutter.o\
 hash.o imgproc.o indent.o insdel.o intl.o\
 keymap.o $(RTC_patch_objs) line-number.o $(ldap_objs) lread.o lstream.o\
 $(mc_alloc_objs) \
 macros.o marker.o md5.o minibuf.o $(mswindows_objs) $(mswindows_gui_objs)\
 $(mule_objs) $(mule_canna_objs) $(mule_wnn_objs) $(number_objs) objects.o\
 opaque.o $(postgresql_objs) print.o process.o $(process_objs) $(profile_objs)\
 rangetab.o realpath.o redisplay.o redisplay-output.o regex.o\
 search.o select.o $(sheap_objs) $(shlib_objs) signal.o sound.o\
 specifier.o strftime.o $(sunpro_objs) symbols.o syntax.o sysdep.o\
 text.o $(tooltalk_objs) $(tty_objs) undo.o unicode.o $(x_objs) $(x_gui_objs)\
 widget.o window.o $(win32_objs)

obj_rtl = $(objs:.o=.c.rtl)

#ifdef REL_ALLOC
rallocdocsrc = ralloc.c
rallocobjs = ralloc.o
#endif

malloclib = $(libmcheck)
#ifndef SYSTEM_MALLOC
# ifdef GNU_MALLOC  /* GNU malloc */
#  ifdef ERROR_CHECK_MALLOC
#ifdef DOUG_LEA_MALLOC
mallocobjs = free-hook.o vm-limit.o
#else
mallocobjs = gmalloc.o free-hook.o vm-limit.o
#endif
mallocdocsrc = free-hook.c
#  else /* New GNU malloc, sans error checking */
#ifdef DOUG_LEA_MALLOC
mallocobjs = vm-limit.o
#else
mallocobjs = gmalloc.o vm-limit.o
#endif
mallocdocsrc =
#  endif /* ERROR_CHECK_MALLOC */
# else /* Older GNU malloc */
mallocobjs = malloc.o
mallocdocsrc =
# endif /* Older GNU malloc */
#else /* SYSTEM_MALLOC */
mallocobjs =
mallocdocsrc =
#ifdef USE_DEBUG_MALLOC
malloclib = -ldmalloc
#endif /* USE_DEBUG_MALLOC */
#endif /* SYSTEM_MALLOC */

#ifdef HAVE_X_WINDOWS

lwlib_lib = ../lwlib/liblw.a

# ifdef EXTERNAL_WIDGET
external_widget_objs = ExternalShell.o extw-Xt-nonshared.o extw-Xlib-nonshared.o

#  ifdef LWLIB_USES_MOTIF
#    ifdef EXTW_LINK
motif_other_files = libextcli_Xm.a libextcli_Xm.so.1
#    else
motif_other_files = libextcli_Xm.a
#    endif
#endif /* LWLIB_USES_MOTIF */

#  ifdef EXTW_LINK
shared_other_files = libextcli_Xt.so.1 libextcli_Xlib.so.1
#  endif
other_files=\
 $(motif_other_files)\
 libextcli_Xt.a libextcli_Xlib.a\
 $(shared_other_files)

# endif /* EXTERNAL_WIDGET */

# if defined (HAVE_OFFIX_DND) || defined (HAVE_CDE)
dnd_objs = @dnd_objs@
# endif /* HAVE_OFFIX_DND || HAVE_CDE */

X11_objs =  EmacsFrame.o EmacsShell.o TopLevelEmacsShell.o TransientEmacsShell.o EmacsManager.o $(external_widget_objs) $(dnd_objs)
#endif /* HAVE_X_WINDOWS */

## define otherobjs as list of object files that make-docfile
## should not be told about.
otherobjs = lastfile.o $(mallocobjs) $(rallocobjs) $(X11_objs) $(export_lib)
otherrtls = $(otherobjs:.o=.c.rtl)
othersrcs = $(otherobjs:.o=.c)

LIBES = $(lwlib_lib) $(malloclib) $(ld_libs_all) $(lib_gcc)

#ifdef I18N3
mo_file = $(LIB_SRC)/emacs.mo
#endif

#########################################################################
##                           Implicit rules                            ##
#########################################################################

## For performance and consistency, no built-in rules.
.SUFFIXES:
.SUFFIXES: .c .h .o .i .s .dep

## -Demacs is needed to make some files produce the correct version
## for use in Emacs.

cppflags = $(CPPFLAGS) -Demacs -I. $(c_switch_all)
cflags   = $(CFLAGS) $(cppflags)
#if defined (WIN32_NATIVE)
ldflags  = $(LDFLAGS) -mwindows -e _mainCRTStartup $(ld_switch_all) $(ld_dynamic_link_flags)
#else
ldflags  = $(LDFLAGS) $(ld_switch_all) $(ld_dynamic_link_flags)
#endif

#if defined (CYGWIN) && !defined (PDUMP)
ldflags += -Wl,--script=s/cygwin.sc
#endif

#ifdef SOLARIS2
%.o : %.c
#else
.c.o:
#endif
	$(CC) -c $(cflags) $<

## Create preprocessor output (debugging purposes only)
.c.i:
#ifdef __GNUC__
	$(CC) -E $(cppflags) -o $@ $<
#else /* works on Solaris; what about other systems? */
	$(CC) -P $(cppflags) $<
#endif /* compiler */

## Create assembler output (debugging purposes only)
.c.s:
	$(CC) -S -c $(cflags) $<

## Create RTL files
%.c.rtl : %.c
	$(CC) -dr -c $(cflags) $<

#########################################################################
##                     Primary rebuilding process                      ##
#########################################################################

#ifdef PDUMP
DUMP_TARGET = $(PROGNAME).dmp
RAW_EXE  = $(PROGNAME)
DUMP_ID     = dump-id.o
#if !defined(WIN32_NATIVE) && defined(DUMP_IN_EXEC)
DUMP_TARGET = $(PROGNAME)
#ifndef CYGWIN
RAW_EXE  = temacs
#else
RAW_EXE  = temacs.exe
#endif
#endif
#else
DUMP_TARGET = $(PROGNAME)
RAW_EXE  = temacs
#endif

DO_TEMACS = $(DUMPENV) ./$(RAW_EXE)
DO_XEMACS = ./$(PROGNAME)

BATCH = -no-packages -batch
BATCH_PACKAGES = -vanilla -batch
TEMACS_BATCH = $(DO_TEMACS) -nd $(BATCH)
XEMACS_BATCH = $(DO_XEMACS) $(BATCH)
XEMACS_BATCH_PACKAGES = $(DO_XEMACS) $(BATCH_PACKAGES)
temacs_loadup_args = -l $(LISP)/loadup.el
dump_temacs_args   = $(temacs_loadup_args) dump
run_temacs_args = $(temacs_loadup_args) run-temacs
dump_temacs = $(TEMACS_BATCH) $(dump_temacs_args)

## Compile, dump, and make sure all .elc files are up-to-date.

## NOTE NOTE NOTE: There appears to be a fundamental but non-obvious
## difference between the way that standard `make', GNU Make, and `nmake'
## handle dependencies, and this means we have to write the dependencies in
## Makefile.in.in and xemacs.mak differently.  To illustrate this, consider
## the following first:

##.PHONY: all (`make' only)
## all: test.exe
##
##.PHONY: FRC.test.c (`make' only)
##FRC.test.c:
##
##test.c: FRC.test.c
##	if test ! -f foo ; then touch test.c; fi (`make' only)
##	if not exist foo touch test.c (`nmake' only)
##
##test.obj: test.c
##	touch test.obj
##
##test.exe: test.obj
##	touch test.exe

## (GNU Make doesn't need the .PHONY declarations, but evidently some versions
## of `make' do.  nmake doesn't need them and doesn't allow them, either.)

## Running `make' rebuilds test.exe only if `foo' doesn't exist.
## Running `nmake -f Makefile' rebuilds it regardless.

## Both conclude that test.c needs to be rebuilt since its dependent is
## non-existent.  But `make' recalculates its dependencies after running
## the commands for test.c, and notices that test.c hasn't changed, and
## thus test.obj and test.exe are up-to-date.  `nmake' doesn't.

## On the other hand, consider the following:

##.PHONY: all (`make' only)
##all: check-foo test.exe
##
##.PHONY: check-foo (`make' only)
##check-foo:
##	if test ! -f foo; then touch test.c; fi (`make' only)
##	if not exist foo touch test.c (`nmake' only)
##
##test.c:
##	touch test.c
##
##test.obj: test.c
##	touch test.obj
##
##test.exe: test.c test.obj
##	touch test.exe
##

## Running `nmake -f Makefile' (and `GNU make') rebuilds test.exe only if
## `foo' doesn't exist.
## Running some versions of non-GNU `make' does nothing at all once test.c,
## test.obj and test.exe all exist.

## It appears that `nmake' doesn't check dependencies for test.exe until it
## actually needs to be rebuilt, so this "sideways" dependency script
## works.  GNU make evidently recalculates *all* dependencies after each
## command so has no problem, either.  But some makes apparently calculate
## all dependencies at startup and then, after executing a command to build
## a dependency, only recheck relationships involving that particular
## dependency.

## In XEmacs-land, the above situation exists wrt the `NEEDTODUMP'
## dependency, recalculated by `update-elc.el'.  Thus, Makefile.in.in must
## use the method #1 above, and nmake must use method #2.

## -ben

.PHONY: build-the-mofo
build-the-mofo: update-elc-2 $(mo_file) $(other_files) $(LISP)/finder-inf.el load-shadows

## (1) Compile all dependencies of the XEmacs executable

#ifdef HAVE_X_WINDOWS
lwlib_deps = $(lwlib_lib)
$(lwlib_lib):
	cd ../lwlib && $(MAKE) $(RECURSIVE_MAKE_ARGS)
#endif /* HAVE_X_WINDOWS */

#ifdef DYNODUMP
dynodump_deps = ../dynodump/dynodump.so
../dynodump/dynodump.so:
	cd ../dynodump && $(MAKE) $(RECURSIVE_MAKE_ARGS)
#endif /* DYNODUMP */

link_deps = $(start_files) $(objs) $(otherobjs) $(lwlib_deps) $(dynodump_deps)

$(LIB_SRC)/make-dump-id:
	cd $(LIB_SRC) && $(MAKE) $(RECURSIVE_MAKE_ARGS) make-dump-id

dump-id.c: $(LIB_SRC)/make-dump-id $(link_deps)
	$(LIB_SRC)/make-dump-id

## (2) Link the XEmacs executable

#if !defined(PDUMP) || !defined(DUMP_IN_EXEC) || defined(WIN32_NATIVE)
$(RAW_EXE): $(link_deps) $(DUMP_ID)
	$(LD) $(start_flags) $(ldflags) -o $@ $(start_files) $(objs) $(otherobjs) $(DUMP_ID) $(LIBES)
#else
$(RAW_EXE): $(link_deps) $(DUMP_ID)
	if test -f dump-size ; then \
		$(CC) -c $(cflags) -DMAX_SIZE=`cat dump-size` $(SRC)/dump-data.c ;\
	else \
		$(CC) -c $(cflags) -DMAX_SIZE=0 $(SRC)/dump-data.c ;\
	fi
	$(LD) $(start_flags) $(ldflags) -o $@ $(start_files) $(objs) $(otherobjs) $(DUMP_ID) dump-data.o $(LIBES)
#endif

## (3) Update the .elc's needed for dumping

.PHONY: FRC.needtodump
FRC.needtodump:

## This file is touched by update-elc.el when redumping is necessary.
## We use $(BLDSRC) == `.' here to help keep sync with nt/xemacs.mak,
## where $(BLDSRC) is not `.'.
$(BLDSRC)/NEEDTODUMP: $(RAW_EXE) FRC.needtodump
	$(TEMACS_BATCH) -l $(LISP)/update-elc.el

## (4) Build the DOC file

obj_src = $(objs:.o=.c)

$(LIB_SRC)/make-docfile:
	cd $(LIB_SRC) && $(MAKE) $(RECURSIVE_MAKE_ARGS) make-docfile

$(LIB_SRC)/DOC: $(LIB_SRC)/make-docfile $(BLDSRC)/NEEDTODUMP $(temacs_deps)
#ifdef QUICK_BUILD
	if test ! -f $@ ; then \
#else
	if true ; then \
#endif
	$(TEMACS_BATCH) -l $(LISP)/make-docfile.el -- \
		-o $(LIB_SRC)/DOC -d $(SRC) -i $(LIB_SRC)/../site-packages \
		$(obj_src) $(mallocdocsrc) $(rallocdocsrc) \
		$(extra_doc_files) ; fi

## (5) Dump

$(DUMP_TARGET): $(RAW_EXE) $(BLDSRC)/NEEDTODUMP $(LIB_SRC)/DOC
#ifdef HEAP_IN_DATA
	@$(RM) $@ && touch SATISFIED
	$(dump_temacs)
	@if test -f SATISFIED; then $(RM) SATISFIED; else $(RM) $@; \
	$(MAKE) $(RECURSIVE_MAKE_ARGS) $@; fi
#else
	@$(RM) $@
	$(dump_temacs)
#endif
#if defined(PDUMP) && defined(DUMP_IN_EXEC) && !defined(WIN32_NATIVE)
	if test -f dump-size; then \
		$(LIB_SRC)/insert-data-in-exec $(RAW_EXE) $(DUMP_TARGET).dmp $(DUMP_TARGET) `$(DO_TEMACS) -si`; \
		ret=$$? ; \
		if test $${ret} -eq 2; then \
			$(RM) dump-size ; \
		else \
			if test $${ret} -eq 1; then \
				exit 1; \
			else \
				chmod +x $(DUMP_TARGET) ; \
			fi ; \
		fi ; \
	fi
	if test ! -f dump-size; then \
		$(LIB_SRC)/insert-data-in-exec -s $(DUMP_TARGET).dmp > dump-size ; \
		$(RM) dump-data.o $(DUMP_TARGET) $(DUMP_TARGET).dmp $(RAW_EXE);\
		$(MAKE) $(RECURSIVE_MAKE_ARGS) $@; \
	fi
#endif

## (6) Update the remaining .elc's, post-dumping

.PHONY: update-elc-2
update-elc-2: $(DUMP_TARGET)
	$(XEMACS_BATCH) -no-autoloads -l update-elc-2.el -f batch-update-elc-2 $(LISP)

## (7) Other random stuff

$(LISP)/finder-inf.el: update-elc-2
	@echo "Building finder database ..."
	$(RM) $(LISP)/finder-inf.el
	$(XEMACS_BATCH)	-eval "(setq finder-compile-keywords-quiet t)" \
		-l finder -f finder-compile-keywords
	@echo "Building finder database ...(done)"

.PHONY: load-shadows
load-shadows: update-elc-2
#ifndef QUICK_BUILD
	@echo "Testing for Lisp shadows ..."
	@$(XEMACS_BATCH) -f list-load-path-shadows
#endif

###################### Misc targets

release: all
	-if [ -w $(LISP) ]; then \
	  w=`pwd`; cd $(SRC) && $$w/$(RAW_EXE) -nd $(BATCH) -l $(LISP)/inc-vers; \
	else true; fi
	-$(dump_temacs)
	touch release

.PHONY: fastdump
fastdump: $(RAW_EXE)
	@$(RM) $(DUMP_TARGET) && touch SATISFIED
	-$(dump_temacs)
	@$(XEMACS_BATCH) -f list-load-path-shadows

.PHONY: all-elc
all-elc:
	cd .. && $(MAKE) $(RECURSIVE_MAKE_ARGS)

#########################################################################
##                     Subsidiary dependency rules                     ##
#########################################################################

#ifdef I18N3

# if defined(SPARC) && !defined(USG)
   xgettext=		 /usr/openwin/bin/xgettext
   xgettext_args=	 -o emacs -m_X messages
   msgfmt=		 /usr/openwin/bin/msgfmt
# else
   xgettext=		 xgettext
   xgettext_args=	 -s -d emacs -M_X messages
   msgfmt=		 msgfmt
#endif

$(LIB_SRC)/emacs.po: $(LIB_SRC)/make-msgfile $(LIB_SRC)/make-po $(objs)
	$(LIB_SRC)/make-msgfile -o $(LIB_SRC)/messages $(objs)
	cd $(LIB_SRC) && $(xgettext) $(xgettext_args)
	$(RM) $(LIB_SRC)/emacs.po
	cd $(LIB_SRC) && $(LIB_SRC)/make-po -a $(LIB_SRC)/emacs.po DOC

$(LIB_SRC)/emacs.mo: $(LIB_SRC)/emacs.po
	cd $(LIB_SRC)/ && $(msgfmt) -o emacs.mo emacs.po

$(LIB_SRC)/make-msgfile:
	cd $(LIB_SRC) && $(MAKE) $(RECURSIVE_MAKE_ARGS) make-msgfile

$(LIB_SRC)/make-po:
	cd $(LIB_SRC) && $(MAKE) $(RECURSIVE_MAKE_ARGS) make-po

#endif /* I18N3 */

TopLevelEmacsShell.o : $(SRC)/EmacsShell-sub.c config.h xintrinsicp.h EmacsShellP.h
	$(CC) -c $(cflags) -DDEFINE_TOP_LEVEL_EMACS_SHELL $(SRC)/EmacsShell-sub.c
	mv EmacsShell-sub.o TopLevelEmacsShell.o

TopLevelEmacsShell.c.rtl : $(SRC)/EmacsShell-sub.c config.h xintrinsicp.h EmacsShellP.h
	$(CC) -dr -c $(cflags) -DDEFINE_TOP_LEVEL_EMACS_SHELL $(SRC)/EmacsShell-sub.c
	mv EmacsShell-sub.c.rtl TopLevelEmacsShell.c.rtl

TransientEmacsShell.o : $(SRC)/EmacsShell-sub.c TopLevelEmacsShell.o config.h xintrinsicp.h EmacsShellP.h
	$(CC) -c $(cflags) -DDEFINE_TRANSIENT_EMACS_SHELL $(SRC)/EmacsShell-sub.c
	mv EmacsShell-sub.o TransientEmacsShell.o

TransientEmacsShell.c.rtl : $(SRC)/EmacsShell-sub.c TopLevelEmacsShell.o config.h xintrinsicp.h EmacsShellP.h
	$(CC) -dr -c $(cflags) -DDEFINE_TRANSIENT_EMACS_SHELL $(SRC)/EmacsShell-sub.c
	mv EmacsShell-sub.c.rtl TransientEmacsShell.c.rtl

## The above rules are subject to a race condition if using a parallel make.
TransientEmacsShell.o : TopLevelEmacsShell.o
TransientEmacsShell.c.rtl : TopLevelEmacsShell.c.rtl

## Position-independent code for shared library creation
#if USE_GCC
pic_arg = -fpic
#elif defined (IRIX)
pic_arg = -KPIC
# else
pic_arg = -K pic
#endif

#ifdef EXTERNAL_WIDGET

external_client_motif_objs_shared    = ExternalClient-Xm-shared.o extw-Xt-shared.o extw-Xlib-shared.o
external_client_xt_objs_shared       = ExternalClient-Xt-shared.o extw-Xt-shared.o extw-Xlib-shared.o
external_client_xlib_objs_shared     = ExternalClient-Xlib-shared.o extw-Xlib-shared.o
external_client_motif_objs_nonshared = ExternalClient-Xm-nonshared.o extw-Xt-nonshared.o extw-Xlib-nonshared.o
external_client_xt_objs_nonshared    = ExternalClient-Xt-nonshared.o extw-Xt-nonshared.o extw-Xlib-nonshared.o
external_client_xlib_objs_nonshared  = ExternalClient-Xlib-nonshared.o extw-Xlib-nonshared.o

## Add dependencies so things work right with a parallel make
ExternalClient-Xm-shared.o: $(SRC)/ExternalClient.c ExternalClient-Xt-shared.o ExternalClient-Xm-nonshared.o
	$(CC) -c $(pic_arg) $(cflags) -DEXTW_USES_MOTIF $(SRC)/ExternalClient.c
	mv ExternalClient.o ExternalClient-Xm-shared.o

ExternalClient-Xt-shared.o: $(SRC)/ExternalClient.c ExternalClient-Xt-nonshared.o
	$(CC) -c $(pic_arg) $(cflags) $(SRC)/ExternalClient.c
	mv ExternalClient.o ExternalClient-Xt-shared.o

ExternalClient-Xlib-shared.o: $(SRC)/ExternalClient-Xlib.c ExternalClient-Xlib-nonshared.o
	$(CC) -c $(pic_arg) $(cflags) $(SRC)/ExternalClient-Xlib.c
	mv ExternalClient-Xlib.o ExternalClient-Xlib-shared.o

ExternalClient-Xm-nonshared.o: $(SRC)/ExternalClient.c ExternalClient-Xt-nonshared.o
	$(CC) -c $(cflags) -DEXTW_USES_MOTIF $(SRC)/ExternalClient.c
	mv ExternalClient.o ExternalClient-Xm-nonshared.o

ExternalClient-Xt-nonshared.o: $(SRC)/ExternalClient.c
	$(CC) -c $(cflags) $(SRC)/ExternalClient.c
	mv ExternalClient.o ExternalClient-Xt-nonshared.o

ExternalClient-Xlib-nonshared.o: $(SRC)/ExternalClient-Xlib.c
	$(CC) -c $(cflags) $(SRC)/ExternalClient-Xlib.c
	mv ExternalClient-Xlib.o ExternalClient-Xlib-nonshared.o

## We compile the common files twice (once with PIC and once without)
## because on some systems, compiling with PIC but not linking into
## a shared library messes things up.

extw-Xt-shared.o: $(SRC)/extw-Xt.c extw-Xt-nonshared.o
	$(CC) -c $(pic_arg) $(cflags) $(SRC)/extw-Xt.c
	mv extw-Xt.o extw-Xt-shared.o

extw-Xlib-shared.o: $(SRC)/extw-Xlib.c extw-Xlib-nonshared.o
	$(CC) -c $(pic_arg) $(cflags) $(SRC)/extw-Xlib.c
	mv extw-Xlib.o extw-Xlib-shared.o

extw-Xt-nonshared.o: $(SRC)/extw-Xt.c
	$(CC) -c $(cflags) $(SRC)/extw-Xt.c
	mv extw-Xt.o extw-Xt-nonshared.o

extw-Xlib-nonshared.o: $(SRC)/extw-Xlib.c
	$(CC) -c $(cflags) $(SRC)/extw-Xlib.c
	mv extw-Xlib.o extw-Xlib-nonshared.o

libextcli_Xm.a: $(external_client_motif_objs_nonshared)
	ar r libextcli_Xm.a $(external_client_motif_objs_nonshared)

libextcli_Xt.a: $(external_client_xt_objs_nonshared)
	ar r libextcli_Xt.a $(external_client_xt_objs_nonshared)

libextcli_Xlib.a: $(external_client_xlib_objs_nonshared)
	ar r libextcli_Xlib.a $(external_client_xlib_objs_nonshared)

## Now we try to figure out how to link a shared library.
## If we cannot figure it out, leave EXTW_LINK undefined and a shared
## library will not be created.

# ifdef USE_GCC
#  ifdef USG5
#   define EXTW_LINK(objs, output) $(CC) -shared objs -Xlinker -z -Xlinker text -o output
extw_link_beg = $(CC) -shared
extw_link_mid = -Xlinker -z -Xlinker text -o
extw_link_end =
## I cannot figure out how to do shared a.out libraries, so just punt.
#  elif !defined (LINUX) || defined (__ELF__)
#   define EXTW_LINK(objs, output) $(CC) -shared objs -o output
extw_link_beg = $(CC) -shared
extw_link_mid = -o
extw_link_end =
#  endif
# elif defined (USG5)
#  if defined (IRIX)
#   define EXTW_LINK(objs, output) $(LD) -shared -g -check_registry $(TOOLROOT)/usr/lib/so_locations objs -o output
extw_link_beg = $(LD) -shared -g -check_registry $(TOOLROOT)/usr/lib/so_locations
extw_link_mid =  -o
extw_link_end =
#  else /* not IRIX */
#   define EXTW_LINK(objs, output) $(CC) -G objs -z text -o output
extw_link_beg = $(CC) -G
extw_link_mid = -z text -o
extw_link_end =
#  endif /* not IRIX */
# else /* not USG5 */
#  if defined (DEC_ALPHA) && defined (OSF1)
#   define EXTW_LINK(objs, output) $(LD) $(ldflags) $(ld_switch_shared) -d objs -o output $(LIBES)
extw_link_beg = $(LD) $(ldflags) $(ld_switch_shared) -d
extw_link_mid = -o
extw_link_end = $(LIBES)
#  else /* !(DEC_ALPHA && OSF1) */
#   define EXTW_LINK(objs, output) $(LD) -dc objs -assert pure-text -o output
extw_link_beg = $(LD) -dc
extw_link_mid = -assert pure-text -o
extw_link_end =
#  endif /* !(DEC_ALPHA && OSF1) */
# endif /* not USG5 */

#ifdef EXTW_LINK

libextcli_Xm.so.1: $(external_client_motif_objs_shared)
	$(extw_link_beg) $(external_client_motif_objs_shared) $(extw_link_mid) libextcli_Xm.so.1 $(extw_link_end)

libextcli_Xt.so.1: $(external_client_xt_objs_shared)
	$(extw_link_beg) $(external_client_xt_objs_shared) $(extw_link_mid) libextcli_Xt.so.1 $(extw_link_end)

libextcli_Xlib.so.1: $(external_client_xlib_objs_shared)
	$(extw_link_beg) $(external_client_xlib_objs_shared) $(extw_link_mid) libextcli_Xlib.so.1 $(extw_link_end)

#endif /* EXTW_LINK */

#endif /* EXTERNAL_WIDGET */

config.h: $(SRC)/config.h.in
Emacs.ad.h: $(ETC)/Emacs.ad

config.h sheap-adjust.h paths.h Emacs.ad.h :
	@echo "The file $@ needs to be re-generated."
	@echo "Please run a make in the top level directory."
	@echo "Consult the file \`INSTALL' for instructions for building XEmacs."
	@exit 1

## Some machines have alloca built-in.
## They should define HAVE_ALLOCA, or may just let alloca.s
## be used but generate no code.
## Some have it written in assembler in alloca.s.
## Some use the C version in alloca.c (these define C_ALLOCA in config.h).
## Nowadays we always compile in the C version and use it to avoid stack
## overflow.

#ifdef C_ALLOCA
#else
#ifndef HAVE_ALLOCA
allocax.o : $(SRC)/alloca.s config.h
## $(CPP) is cc -E, which may get confused by filenames
## that do not end in .c.  So copy file to a safe name.  */
##	cp $(SRC)/alloca.s allocatem.c
## Remove any ^L, blank lines, and preprocessor comments,
## since some assemblers barf on them.  Use a different basename for the
## output file, since some stupid compilers (Green Hill) use that
## name for the intermediate assembler file.
	$(CPP) $(cppflags) allocatem.c | \
	sed -e 's///' -e 's/^#.*//' | \
	sed -n -e '/^..*$$/p' > allocax.s
	@$(RM) alloca.o
## Xenix, in particular, needs to run assembler via cc.
	$(CC) -c allocax.s
	$(RM) allocax.s allocatem.c
#endif /* HAVE_ALLOCA */
#endif /* ! defined (C_ALLOCA) */

#ifdef HAVE_NATIVE_SOUND
sound_cflags=@sound_cflags@
sunplay.o: $(SRC)/sunplay.c
	$(CC) -c  $(sound_cflags) $(cflags) $(SRC)/sunplay.c
hpplay.o: $(SRC)/hpplay.c
	$(CC) -c -Demacs $(sound_cflags) $(cflags) $(SRC)/hpplay.c
#endif /* HAVE_NATIVE_SOUND */

#if defined(HAVE_GLADE_GLADE_H) || defined(HAVE_GLADE_H)
glade_files=glade.c
#endif

#ifdef HAVE_GTK
extra_doc_files=emacs-widget-accessors.c ui-byhand.c $(glade_files)
#endif

xemacs_res.o: $(SRC)/../nt/xemacs.rc
	windres --include-dir $(SRC)/../nt -i $(SRC)/../nt/xemacs.rc -o $@

#########################################################################
##                          Other random crap                          ##
#########################################################################

dortl : $(obj_rtl) $(otherrtls)
	echo "(defvar source-files '(" > $(LISP)/source-files.el
	(for a in $(obj_src) $(othersrcs);do \
	echo -n "\""$$a"\"" >> $(LISP)/source-files.el ;\
	done)
	echo "))" >> $(LISP)/source-files.el

###################### Lint
LINT.c=$(LINT) $(LINTFLAGS) $(LINTINCLUDES)
LINTFILES= $(objs:.o=.ln)
LINTINCLUDES = $(cppflags)
## LINTFLAGS= -fd -m -p -s -u -v -x
LINTFLAGS= -fd -m -s -u -v -x
.PHONY: lint
lint: $(LINTFILES)
	$(LINT.c) $(LINTFILES)

###################### Automated tests
testdir = $(SRC)/../tests/automated
batch_test_emacs = $(BATCH_PACKAGES) -l $(testdir)/test-harness.el -f batch-test-emacs $(testdir)

.PHONY: check check-temacs check-features
check:
	$(DO_XEMACS) $(batch_test_emacs)
check-temacs:
	$(TEMACS_BATCH) $(run_temacs_args) $(batch_test_emacs)
check-features: all
	$(XEMACS_BATCH) -l check-features.el

###################### Debugging targets

## None of the debugging products work with a dumped xemacs binary,
## because it does unexpected things like free memory that has been
## malloc'ed in a *different* process!!  So we need to run these on
## temacs.

## RTC is Sun WorkShop's Run Time Checking, integrated with dbx
rtc_patch.o:
	rtc_patch_area -o $@

rtcmacs: $(temacs_deps) rtc_patch.o
	$(RM) $(RAW_EXE); $(MAKE) $(RECURSIVE_MAKE_ARGS) $(RAW_EXE) RTC_patch_objs=rtc_patch.o
	mv $(RAW_EXE) rtcmacs

.PHONY: run-rtcmacs
run-rtcmacs: rtcmacs
	dbx -q -C -c \
	'dbxenv rtc_error_log_file_name /dev/fd/1; \
	dbxenv suppress_startup_message 5.0; \
	ignore POLL; \
	check -access; \
	suppress rui; \
	runargs -nd $(BATCH) $(run_temacs_args) -vanilla; \
	run' rtcmacs

debug-temacs: $(RAW_EXE)
	-gdb $(RAW_EXE)

## Purify, Quantify, PureCoverage are software quality products from
## Rational, formerly Pure Atria, formerly Pure Software.
##
## Purify
PURIFY_PROG  = purify
PURIFY_LIBS  =
PURIFY_FLAGS =\
#ifdef PDUMP
 -search-mmaps=yes\
#endif
 -chain-length=32 -ignore-signals=SIGPOLL\
 -cache-dir=$(blddir)/purecache -always-use-cache-dir=yes

puremacs: $(temacs_deps)
	$(PURIFY_PROG) $(PURIFY_FLAGS) $(LD) $(temacs_link_args) $(PURIFY_LIBS)
	cp $@ $(RAW_EXE)

## Quantify
#ifdef  QUANTIFY
QUANTIFY_PROG     = quantify
QUANTIFY_HOME     = `$(QUANTIFY_PROG) -print-home-dir`
QUANTIFY_FLAGS    = -cache-dir=./purecache -always-use-cache-dir=yes
cppflags         += -I$(QUANTIFY_HOME)
temacs_link_args += $(QUANTIFY_HOME)/quantify_stubs.a

quantmacs: $(temacs_deps)
	$(QUANTIFY_PROG) $(QUANTIFY_FLAGS) $(LD) $(temacs_link_args)
	cp $@ $(RAW_EXE)
#endif /* QUANTIFY */

PURECOV_PROG=purecov
covmacs: $(temacs_deps)
	$(PURECOV_PROG) $(LD) $(temacs_link_args)

###################### Clean

.PHONY: mostlyclean clean distclean realclean versionclean extraclean
mostlyclean:
	$(RM) *.o *.i *.rtl *.ln core \
	temacs puremacs quantmacs covmacs rtcmacs temacs.exe \
	sheap-adjust.h dump-id.c $(BLDSRC)/NEEDTODUMP SATISFIED \
	$(LIB_SRC)/*.po $(LIB_SRC)/*.mo
versionclean:
	$(RM) $(RAW_EXE) $(DUMP_TARGET) $(LIB_SRC)/DOC
##      Remove the generated load files here; they cause lots of problems
##      when they don't work right.
clean: mostlyclean versionclean
	$(RM) libextcli* $(LISP)/auto-autoloads.el* $(LISP)/custom-load.el* \
	$(LISP)/mule/auto-autoloads.el* $(LISP)/mule/custom-load.el* \
	$(SRCMODULES)/auto-autoloads.el* $(SRCMODULES)/custom-load.el*
## This is used in making a distribution.
## Do not use it on development directories!
distclean: clean
	$(RM) config.h paths.h Emacs.ad.h $(LISP)/finder-inf.el* \
	GNUmakefile Makefile Makefile.in TAGS $(DUMP_TARGET) $(RAW_EXE) \
	xemacs.def xemacs.def.in
realclean: distclean
extraclean: realclean
	$(RM) *~ \#* m/*~ m/\#* s/*~ s/\#*

###################### Lock, unlock

.PHONY : lock unlock
SOURCES = *.[chm] *.pswm [sm]/* COPYING paths.h.in Makefile.in.in \
	config.h.in README COPYING ChangeLog
unlock:
	chmod u+w $(SOURCES)

relock:
	chmod -w $(SOURCES)

###################### Installation

## Header files for ellcc
#ifdef HAVE_SHLIB
MAKEPATH=../lib-src/make-path
install: $(PROGNAME)
	$(MAKEPATH) $(archlibdir)/include $(archlibdir)/include/m $(archlibdir)/include/s
	-@echo "Copying include files for ellcc..."
	-@hdir=`pwd`; \
	cd $(SRC); hdrdir2=`pwd`; cd $$hdir; \
	test "$$hdrdir2" != "$$hdir" && hdir="$$hdir $$hdrdir2"; \
	(for thisdir in $$hdir; do \
		cd $$thisdir && \
		(hdrtars=; \
		for hdrfile in *.h; do \
			hdrtars="$$hdrtars $$hdrfile"; \
		done; \
		test -d s && hdrtars="$$hdrtars s/*"; \
		test -d m && hdrtars="$$hdrtars m/*"; \
		test -n "$$hdrtars" && (tar cf - $$hdrtars) | \
			(cd $(archlibdir)/include && umask 022 && tar xf -); \
		chmod 755 $(archlibdir)/include; \
		test -d $(archlibdir)/include/s && \
		  chmod 755 $(archlibdir)/include/s; \
		test -d $(archlibdir)/include/m && \
		  chmod 755 $(archlibdir)/include/s;) \
	done)
#endif

###################### Dependencies

## Dependency processing using home-grown script, not makedepend
.PHONY: depend
FRC.depend:
depend: FRC.depend
	cd $(SRC) && $(RM) depend.tmp && \
	perl ./make-src-depend > depend.tmp && \
	if cmp -s depend depend.tmp; \
	then $(RM) depend.tmp; \
	else $(RM) depend && mv depend.tmp depend; \
	fi

###################### Unicode encapsulation

.PHONY: unicode-encapsulate
FRC.unicode-encapsulate:
unicode-encapsulate: FRC.unicode-encapsulate
	cd $(SRC) && \
	perl ../lib-src/make-mswin-unicode.pl --c-output intl-auto-encap-win32.c --h-output intl-auto-encap-win32.h intl-encap-win32.c