/* Argument parsing and main program of GNU Make.
Copyright (C) 1988-2016 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make 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 3 of the License, or (at your option) any later
version.
GNU Make 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
this program. If not, see <http://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "os.h"
#include "filedef.h"
#include "dep.h"
#include "variable.h"
#include "job.h"
#include "commands.h"
#include "rule.h"
#include "debug.h"
#include "getopt.h"
#include <assert.h>
#ifdef _AMIGA
# include <dos/dos.h>
# include <proto/dos.h>
#endif
#ifdef WINDOWS32
# include <windows.h>
# include <io.h>
# include "pathstuff.h"
# include "sub_proc.h"
# include "w32err.h"
#endif
#ifdef __EMX__
# include <sys/types.h>
# include <sys/wait.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef _AMIGA
int __stack = 20000; /* Make sure we have 20K of stack space */
#endif
#ifdef VMS
int vms_use_mcr_command = 0;
int vms_always_use_cmd_file = 0;
int vms_gnv_shell = 0;
int vms_legacy_behavior = 0;
int vms_comma_separator = 0;
int vms_unix_simulation = 0;
int vms_report_unix_paths = 0;
/* Evaluates if a VMS environment option is set, only look at first character */
static int
get_vms_env_flag (const char *name, int default_value)
{
char * value;
char x;
value = getenv (name);
if (value == NULL)
return default_value;
x = toupper (value[0]);
switch (x)
{
case '1':
case 'T':
case 'E':
return 1;
break;
case '0':
case 'F':
case 'D':
return 0;
}
}
#endif
#if defined HAVE_WAITPID || defined HAVE_WAIT3
# define HAVE_WAIT_NOHANG
#endif
#ifndef HAVE_UNISTD_H
int chdir ();
#endif
#ifndef STDC_HEADERS
# ifndef sun /* Sun has an incorrect decl in a header. */
void exit (int) __attribute__ ((noreturn));
# endif
double atof ();
#endif
static void clean_jobserver (int status);
static void print_data_base (void);
static void print_version (void);
static void decode_switches (int argc, const char **argv, int env);
static void decode_env_switches (const char *envar, unsigned int len);
static struct variable *define_makeflags (int all, int makefile);
static char *quote_for_env (char *out, const char *in);
static void initialize_global_hash_tables (void);
/* The structure that describes an accepted command switch. */
struct command_switch
{
int c; /* The switch character. */
enum /* Type of the value. */
{
flag, /* Turn int flag on. */
flag_off, /* Turn int flag off. */
string, /* One string per invocation. */
strlist, /* One string per switch. */
filename, /* A string containing a file name. */
positive_int, /* A positive integer. */
floating, /* A floating-point number (double). */
ignore /* Ignored. */
} type;
void *value_ptr; /* Pointer to the value-holding variable. */
unsigned int env:1; /* Can come from MAKEFLAGS. */
unsigned int toenv:1; /* Should be put in MAKEFLAGS. */
unsigned int no_makefile:1; /* Don't propagate when remaking makefiles. */
const void *noarg_value; /* Pointer to value used if no arg given. */
const void *default_value; /* Pointer to default value. */
const char *long_name; /* Long option name. */
};
/* True if C is a switch value that corresponds to a short option. */
#define short_option(c) ((c) <= CHAR_MAX)
/* The structure used to hold the list of strings given
in command switches of a type that takes strlist arguments. */
struct stringlist
{
const char **list; /* Nil-terminated list of strings. */
unsigned int idx; /* Index into above. */
unsigned int max; /* Number of pointers allocated. */
};
/* The recognized command switches. */
/* Nonzero means do extra verification (that may slow things down). */
int verify_flag;
/* Nonzero means do not print commands to be executed (-s). */
int silent_flag;
/* Nonzero means just touch the files
that would appear to need remaking (-t) */
int touch_flag;
/* Nonzero means just print what commands would need to be executed,
don't actually execute them (-n). */
int just_print_flag;
/* Print debugging info (--debug). */
static struct stringlist *db_flags = 0;
static int debug_flag = 0;
int db_level = 0;
/* Synchronize output (--output-sync). */
char *output_sync_option = 0;
#ifdef WINDOWS32
/* Suspend make in main for a short time to allow debugger to attach */
int suspend_flag = 0;
#endif
/* Environment variables override makefile definitions. */
int env_overrides = 0;
/* Nonzero means ignore status codes returned by commands
executed to remake files. Just treat them all as successful (-i). */
int ignore_errors_flag = 0;
/* Nonzero means don't remake anything, just print the data base
that results from reading the makefile (-p). */
int print_data_base_flag = 0;
/* Nonzero means don't remake anything; just return a nonzero status
if the specified targets are not up to date (-q). */
int question_flag = 0;
/* Nonzero means do not use any of the builtin rules (-r) / variables (-R). */
int no_builtin_rules_flag = 0;
int no_builtin_variables_flag = 0;
/* Nonzero means keep going even if remaking some file fails (-k). */
int keep_going_flag;
int default_keep_going_flag = 0;
/* Nonzero means check symlink mtimes. */
int check_symlink_flag = 0;
/* Nonzero means print directory before starting and when done (-w). */
int print_directory_flag = 0;
/* Nonzero means ignore print_directory_flag and never print the directory.
This is necessary because print_directory_flag is set implicitly. */
int inhibit_print_directory_flag = 0;
/* Nonzero means print version information. */
int print_version_flag = 0;
/* List of makefiles given with -f switches. */
static struct stringlist *makefiles = 0;
/* Size of the stack when we started. */
#ifdef SET_STACK_SIZE
struct rlimit stack_limit;
#endif
/* Number of job slots for parallelism. */
unsigned int job_slots;
#define INVALID_JOB_SLOTS (-1)
static unsigned int master_job_slots = 0;
static int arg_job_slots = INVALID_JOB_SLOTS;
static const int default_job_slots = INVALID_JOB_SLOTS;
/* Value of job_slots that means no limit. */
static const int inf_jobs = 0;
/* Authorization for the jobserver. */
static char *jobserver_auth = NULL;
/* Handle for the mutex used on Windows to synchronize output of our
children under -O. */
char *sync_mutex = NULL;
/* Maximum load average at which multiple jobs will be run.
Negative values mean unlimited, while zero means limit to
zero load (which could be useful to start infinite jobs remotely
but one at a time locally). */
#ifndef NO_FLOAT
double max_load_average = -1.0;
double default_load_average = -1.0;
#else
int max_load_average = -1;
int default_load_average = -1;
#endif
/* List of directories given with -C switches. */
static struct stringlist *directories = 0;
/* List of include directories given with -I switches. */
static struct stringlist *include_directories = 0;
/* List of files given with -o switches. */
static struct stringlist *old_files = 0;
/* List of files given with -W switches. */
static struct stringlist *new_files = 0;
/* List of strings to be eval'd. */
static struct stringlist *eval_strings = 0;
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
windows下的make工具 make-4.2.tar (358个子文件)
ChangeLog.1 48KB
make.1 11KB
ABOUT-NLS 92KB
abspath 2KB
configure.ac 17KB
addprefix 1KB
addsuffix 737B
Makefile.am 7KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 900B
Makefile.am 810B
Makefile.ami 10KB
config.ami 10KB
Makefile.ami 2KB
README.Amiga 3KB
andor 1KB
ar-lib 6KB
archives 6KB
AUTHORS 3KB
automatic 3KB
basename 1KB
build_w32.bat 7KB
dosbuild.bat 3KB
configure.bat 2KB
configure.bat 2KB
subproc.bat 908B
bs-nl 4KB
main.c 104KB
job.c 104KB
read.c 99KB
function.c 69KB
remake.c 55KB
variable.c 54KB
sub_proc.c 49KB
vmsjobs.c 42KB
glob.c 35KB
dir.c 35KB
implicit.c 34KB
file.c 31KB
getopt.c 29KB
arscan.c 28KB
getloadavg.c 25KB
default.c 21KB
vpath.c 19KB
vmsify.c 18KB
commands.c 18KB
expand.c 18KB
output.c 17KB
misc.c 16KB
rule.c 15KB
vms_progname.c 14KB
alloca.c 14KB
posixfcn.c 14KB
vms_export_symbol.c 14KB
fnmatch.c 13KB
posixos.c 11KB
strcache.c 9KB
remote-cstms.c 8KB
ar.c 8KB
pathstuff.c 8KB
hash.c 8KB
load.c 7KB
signame.c 7KB
vmsfunctions.c 6KB
dirent.c 5KB
w32os.c 5KB
getopt1.c 4KB
guile.c 4KB
w32err.c 3KB
vms_exit.c 3KB
amiga.c 3KB
remote-stub.c 3KB
misc.c 2KB
loadapi.c 2KB
version.c 1KB
call 3KB
ChangeLog 44KB
ChangeLog 7KB
clean 1KB
close_stdout 252B
run_make_tests.com 8KB
makefile.com 5KB
config_flags_pm.com 2KB
vms_export_symbol_test.com 937B
comments 1KB
compile 7KB
conditionals 3KB
configure 379KB
COPYING 34KB
COPYING 34KB
CURDIR 447B
README.customs 4KB
dash-B 2KB
dash-C 2KB
dash-e 435B
dash-f 3KB
dash-I 2KB
dash-k 3KB
dash-l 2KB
共 358 条
- 1
- 2
- 3
- 4
资源评论
laiqinghao
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功