/* Argument parsing and main program of GNU Make. Copyright (C) 1988,89,90,91,94,95,96,97,98,99 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 2, 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 GNU Make; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "make.h" #include "dep.h" #include "filedef.h" #include "variable.h" #include "job.h" #include "commands.h" #include "rule.h" #include "debug.h" #include "getopt.h" #include #ifdef _AMIGA # include # include #endif #ifdef WINDOWS32 #include #include "pathstuff.h" #endif #if defined(MAKE_JOBSERVER) && defined(HAVE_FCNTL_H) # include #endif #ifdef _AMIGA int __stack = 20000; /* Make sure we have 20K of stack space */ #endif extern void init_dir PARAMS ((void)); extern void remote_setup PARAMS ((void)); extern void remote_cleanup PARAMS ((void)); extern RETSIGTYPE fatal_error_signal PARAMS ((int sig)); extern void print_variable_data_base PARAMS ((void)); extern void print_dir_data_base PARAMS ((void)); extern void print_rule_data_base PARAMS ((void)); extern void print_file_data_base PARAMS ((void)); extern void print_vpath_data_base PARAMS ((void)); #if defined HAVE_WAITPID || defined HAVE_WAIT3 # define HAVE_WAIT_NOHANG #endif #ifndef HAVE_UNISTD_H extern int chdir (); #endif #ifndef STDC_HEADERS # ifndef sun /* Sun has an incorrect decl in a header. */ extern void exit PARAMS ((int)) __attribute__ ((noreturn)); # endif extern double atof (); #endif static void print_data_base PARAMS ((void)); static void print_version PARAMS ((void)); static void decode_switches PARAMS ((int argc, char **argv, int env)); static void decode_env_switches PARAMS ((char *envar, unsigned int len)); static void define_makeflags PARAMS ((int all, int makefile)); static char *quote_for_env PARAMS ((char *out, char *in)); /* The structure that describes an accepted command switch. */ #if defined(__APPLE__) || defined(NeXT) || defined(NeXT_PDO) /* * The various Apple, NeXT, and NeXT PDO hacks are no longer enabled by * default, so that default behaves matches GNU make. * * The hacks can be enabled selectively enabling the following options. * They can be enabled by setting the variable USE_APPLE_PB_SUPPORT to one * or more of the options, or by specify "-N