From 87e2dd5c98e7bdd770914c2404efd8194778fc93 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Tue, 24 Mar 2015 19:34:57 +0300 Subject: Option --sun to enable syntax and features of SunOS make --- main.c | 14 ++++++++++++++ makeint.h | 1 + 2 files changed, 15 insertions(+) diff --git a/main.c b/main.c index c2d4a0c..9e1a5fc 100644 --- a/main.c +++ b/main.c @@ -247,6 +247,10 @@ int inhibit_print_directory_flag = 0; int print_version_flag = 0; +/* Enable SunOS make syntax and features. */ + +int sun_flag = 0; + /* List of makefiles given with -f switches. */ static struct stringlist *makefiles = 0; @@ -418,6 +422,8 @@ static const char *const usage[] = Consider FILE to be infinitely new.\n"), N_("\ --warn-undefined-variables Warn when an undefined variable is referenced.\n"), + N_("\ + --sun Enable syntax and features of SunOS make.\n"), NULL }; @@ -481,6 +487,7 @@ static const struct command_switch switches[] = "warn-undefined-variables" }, { CHAR_MAX+6, strlist, &eval_strings, 1, 0, 0, 0, 0, "eval" }, { CHAR_MAX+7, string, &sync_mutex, 1, 1, 0, 0, 0, "sync-mutex" }, + { CHAR_MAX+8, flag, &sun_flag, 1, 0, 0, 0, 0, "sun" }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; @@ -1691,7 +1698,10 @@ main (int argc, char **argv, char **envp) #else define_variable_cname ("MAKE_COMMAND", argv[0], o_default, 0); #endif + if (!sun_flag) define_variable_cname ("MAKE", "$(MAKE_COMMAND)", o_default, 1); + else + define_variable_cname ("MAKE", "$(MAKE_COMMAND) --sun", o_default, 1); if (command_variables != 0) { @@ -1791,6 +1801,10 @@ main (int argc, char **argv, char **envp) if (no_builtin_variables_flag) no_builtin_rules_flag = 1; + /* SunOS make always uses second expansion. */ + if (sun_flag) + second_expansion = 1; + /* Construct the list of include directories to search. */ construct_include_path (include_directories == 0 diff --git a/makeint.h b/makeint.h index 343c30d..9cd8e2e 100644 --- a/makeint.h +++ b/makeint.h @@ -614,6 +614,7 @@ extern int print_version_flag, print_directory_flag, check_symlink_flag; extern int warn_undefined_variables_flag, trace_flag, posix_pedantic; extern int not_parallel, second_expansion, clock_skew_detected; extern int rebuilding_makefiles, one_shell, output_sync, verify_flag; +extern int sun_flag; /* can we run commands via 'sh -c xxx' or must we use batch files? */ extern int batch_mode_shell; -- cgit v1.2.3