Changeset 552


Ignore:
Timestamp:
02/14/09 00:51:26 (3 years ago)
Author:
mooneer
Message:

Added pre and post-clean rules, and gcc will compile files only when .c/.cc/.cpp is newer than the .o file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • interpreter/trunk/modules/System/package/builder.kt

    r551 r552  
    5555    property custom_post_install_rules 
    5656        /[Custom install rules (post-install).]/, 
     57    property custom_pre_clean_rules 
     58        /[Custom install rules (pre-clean).]/, 
     59    property custom_post_clean_rules 
     60        /[Custom install rules (post-clean).]/, 
    5761    property module_depends 
    5862        /[Modules that libraries depend on.]/, 
     
    7074        this.custom_pre_install_rules = []; 
    7175        this.custom_post_install_rules = []; 
     76        this.custom_pre_clean_rules = []; 
     77        this.custom_post_clean_rules = []; 
    7278    ] 
    7379]; 
     
    8995        [ 
    9096            # Simple Kite file. Copy to dist folder. 
    91             run_command_with_echo("cp %s dist/%s"|format([lib_file, lib|replace(".", "/")])); 
     97            run_command_with_echo("cp -f %s dist/%s"|format([lib_file, lib|replace(".", "/")])); 
    9298            null; 
    9399            return; 
     
    96102        [ 
    97103            # C++ file. 
    98             run_command_with_echo("%s %s %s -c %s"|format([ 
     104            run_command_with_echo("if [ \! \( -e %s \) -o \( %s -nt %s \) ]; then %s %s %s -c %s; fi"|format([ 
     105                (make System.regex("\\..+?$"))|replace(lib_file, ".o"), 
     106                lib_file, 
     107                (make System.regex("\\..+?$"))|replace(lib_file, ".o"), 
    99108                System.compile_options.build_cplusplus, 
    100109                System.compile_options.build_cxxflags, 
     
    104113        true [ 
    105114            # C file. 
    106             run_command_with_echo("%s %s %s -c %s"|format([ 
     115            run_command_with_echo("if [ \! \( -e %s \) -o \( %s -nt %s \) ]; then %s %s %s -c %s; fi"|format([ 
     116                (make System.regex("\\..+?$"))|replace(lib_file, ".o"), 
     117                lib_file, 
     118                (make System.regex("\\..+?$"))|replace(lib_file, ".o"), 
    107119                System.compile_options.build_cc, 
    108120                System.compile_options.build_cxxflags, 
     
    255267[ 
    256268    process_builder_custom_rules(options, options.custom_pre_install_rules); 
    257     run_command_with_echo("cp -R dist/* %s"|format([System.compile_options.build_install_dir])); 
     269    run_command_with_echo("cp -fR dist/* %s"|format([System.compile_options.build_install_dir])); 
    258270    process_builder_custom_rules(options, options.custom_post_install_rules); 
    259271]; 
     
    273285        (os_args|count > 1 and os_args[1] == "clean") 
    274286        [ 
     287            process_builder_custom_rules(options, options.custom_pre_clean_rules); 
    275288            run_command_with_echo("rm -rf dist/"); 
     289            run_command_with_echo("rm -rf *.o"); 
     290            process_builder_custom_rules(options, options.custom_post_clean_rules); 
    276291        ], 
    277292        (os_args|count > 1 and os_args[1] == "install") 
Note: See TracChangeset for help on using the changeset viewer.