Commit Graph

185 Commits

Author SHA1 Message Date
Jung-uk Kim
04704c638e Remove fictitious support for 80386-class CPUs from bsd.cpu.mk and make(1).
It was removed from head more than 8 years ago (see r137784 and r137785).

Reviewed by:	imp, delphij, dim
2012-12-03 19:27:31 +00:00
Robert Millan
475cc570f4 Map foreign architecture names to FreeBSD naming convention.
Approved by:	kib (mentor)
2012-01-20 18:55:56 +00:00
Ulrich Spörlein
487ac9ac21 Spelling fixes for usr.bin/ 2011-12-30 11:02:40 +00:00
Warner Losh
9a6945bc4a Remove hack needed by 6.x machines and older machines to run newer
makes on FreeBSD/pc98.  The need for this hack has passed.  If you are
one of the rare people that may need this, then you should setenv
MACHINE=pc98 as a workaround.
2010-10-06 20:54:17 +00:00
Warner Losh
2a13464829 Use more portable errx instead of errc. The latter doesn't buy us
anyting anyway, since the error EAGAIN's error message doesn't add
anything to the error strings that are there now.
2010-10-06 20:49:45 +00:00
Warner Losh
83d90bb1dd Remove yet another vestage of alpha support. 2010-04-06 02:48:59 +00:00
David E. O'Brien
290dac20e6 Add ability to search up the directory hierarchy for the system directory.
Do by specifying ".../" with '-m' or MAKESYSPATH (new) environment variable.

Reviewed by:	<sjg@NetBSD.org>
Obtained from:	NetBSD (+ embellishment by me, sent back to NetBSD)
2010-01-04 18:57:22 +00:00
Max Khon
ab5f4f723d Reset UPTODATE gnodes after remaking makefiles when make
is not going to be restarted: such nodes could be marked UPTODATE
without doing rebuild due to remakingMakefiles being TRUE.
2009-10-18 11:28:31 +00:00
Max Khon
c2502d78e1 Avoid infinite loops when remaking makefiles not only
for Makefile targets but also for targets they depend on.
2009-04-07 19:49:38 +00:00
Max Khon
2121816903 Remove duplicate OPTFLAGS definition. 2009-02-02 06:25:57 +00:00
Warner Losh
0c380aef5f Sort the options, per style(9).
Reviewed by:	obrien@
2009-02-02 02:05:58 +00:00
Warner Losh
08581af2e9 David doesn't consider the prior -s behavior a bug. Back out this
change.
2009-01-31 23:17:33 +00:00
Warner Losh
e9b777e9cc Unbreak make -s. There's about a 10% performance improvement with -s
in many environments.  The recent --- blah --- reintroduction has
killed.  That output makes almost no sense when all the other output
is silenced.
2009-01-30 16:12:32 +00:00
David E. O'Brien
ef9977831f Don't enable -Q by default - I've fixed the rescue build issue. 2009-01-13 06:53:53 +00:00
David E. O'Brien
eee3404481 + Add the -Q be-quiet flag for parallel jobs.
- Enable -Q by default for the moment - there is something weird
  going on in the rescue build.
2009-01-03 10:14:01 +00:00
David E. O'Brien
78885448f1 1. Add the ability to tweak the token output before targets in job mode.
E.g.,  .MAKE.JOB.PREFIX=${.newline}---[${.MAKE.PID}]
   would produce

   ---[1234] target ---

2. Added ${.newline} as a simple means of being able to include '\n' in the
   assignment of .MAKE.JOB.PREFIX

Obtained from:	NetBSD
2008-12-29 10:26:02 +00:00
Max Khon
a8e17a098e Exit with error code 2 when run with -k (continue if errors) and build failed. 2008-12-18 12:16:51 +00:00
Ed Schouten
40e761838e Add POSIX -p flag to make(1).
This article [1] describes the -p flag for make(1):

	Write to standard output the complete set of macro definitions and
	target descriptions. The output format is unspecified.

We already support a similar flag (-d g1), but unlike -p, it still
executes commands. Our implementation just turns it into -d g1, but also
sets flag `printGraphOnly', which will cause make(1) to skip execution.

[1] http://www.opengroup.org/onlinepubs/009695399/utilities/make.html

Reviewed by:	imp
PR:		standards/99960
2008-07-30 21:18:38 +00:00
David E. O'Brien
ad9165a038 If the special target .MAKEFILEDEPS exists, then enable the
"remaking makefiles" feature.  Otherwise, follow traditional Pmake behavior.
(hash table will be regenerated and committed follow this commit)
2008-03-12 14:50:58 +00:00
Yaroslav Tykhiy
b9d442c148 The non-POSIX environment variable MAKE was superseded
by MAKEFLAGS ages ago, so don't mention it in comments.

Tested with:	cmp(1)
2008-03-05 20:24:38 +00:00
Yaroslav Tykhiy
0c35219978 Don't forget to set MAKEFLAGS in the childs' environment
from the .MAKEFLAGS global variable even if it's empty or
unset.  This means setting MAKEFLAGS to just an empty string
in the latter case.

If not doing so, make(1) behaved inconsistently WRT MAKEFLAGS.
In particular, it would let a `-f foo' option down to sub-makes
if .MAKEFLAGS was unset.  E.g.,

	env MAKEFLAGS="-f mymakefile" make

would pass `-f mymakefile' down to sub-makes via their environment
(unless mymakefile added something to .MAKEFLAGS).
But any additional options appearing would change this behaviour to
not passing `-f mymakefile' to sub-makes, as in:

	env MAKEFLAGS="-f mymakefile" make -D DUMMY

or

	env MAKEFLAGS="-f mymakefile -D DUMMY" make

(unless mymakefile cleared .MAKEFLAGS).

Also make(1) would leave MAKEFLAGS at its initial value if the
makefile set .MAKEFLAGS to an empty value.  I.e., it was impossible
to override MAKEFLAGS with an empty value.  (Note well that makefiles
are not to touch MAKEFLAGS directly, they alter .MAKEFLAGS instead.
So make(1) can filter out things such as -f when copying MAKEFLAGS
to .MAKEFLAGS at startup.  Direct modifications to MAKEFLAGS just go
nowhere.)

While the original intentions of the BSD make authors are somewhat
unclear here, the bug proves that NOT passing -f options down is
the settled behaviour because the opposite behaviour is totally
unreliable in the presence of any other options.  In addition, not
passing down -f's found in the environment is consistent with doing
so WRT the command line.

Update the manpage accordingly and make the whole description of
MAKEFLAGS and .MAKEFLAGS more consistent as this change indeed
brings more consistency into the reliable behaviour of make(1).

Submitted by:	ru (main.c)
Tested with:	make world
2008-03-05 20:11:04 +00:00
Warner Losh
51f0bfca68 Note 7.0 was the first version that FreeBSD/pc98 had a MACHINE of pc98
instead of i386.
2008-03-04 06:08:59 +00:00
Max Khon
cb0ed6eefb Fix -jX when makefiles are remade. 2007-11-25 20:43:27 +00:00
Max Khon
6d000893b4 Change directory back to ${.CURDIR} when remaking Makefiles.
Pointed out by:	ru
2007-06-01 04:20:19 +00:00
Max Khon
bc5748e31f When remaking makefiles check that mtime has actually changed.
This fixes infinite restart in the following case:

Makefile: foo

foo: bar
	do-something

Unlike GNU make, BSD make considers "Makefile" node as remade even
if "foo" is up-to-date and was not actually rebuilt.
GNU make does not consider nodes without commands as remade if child nodes
were not actually rebuilt.

Most probably, more proper fix would be to bring BSD make behaviour in-line
with GNU make but this would be more intrusive change.
2007-04-20 06:25:45 +00:00
Max Khon
9a81351403 Implement "Remaking Makefiles" feature:
After reading Makefile and all the files that are included using .include
or .sinclude directives (source Makefiles) make considers each source
Makefile as a target and tries to rebuild it.  Both explicit and implicit
rules are checked and all source Makefiles are updated if necessary. If
any of the source Makefiles were rebuilt, make restarts from clean state.

To prevent infinite loops the following source Makefile targets are
ignored:
- :: targets that have no prerequisites but have commands
- ! targets
- targets that have .PHONY or .EXEC attributes
- targets without prerequisites and without commands

When remaking a source Makefile options -t (touch target), -q (query
mode), and -n (no exec) do not take effect, unless source Makefile is
specified explicitly as a target in make command line.
Additionally, system makefiles and .depend are not considered as a
Makefiles that can be rebuilt.

Reviewed by:	harti
2007-03-08 09:16:11 +00:00
David E. O'Brien
99f08b7740 whitespace fixing 2006-07-17 19:16:12 +00:00
Ruslan Ermilov
8c7a62275a Prepare for MACHINE and hw.machine switching to "pc98" on FreeBSD/pc98.
Reviewed by:	nyan
2005-12-05 14:22:12 +00:00
David Xu
0f2755724b Quickly fix brokeness in revision 1.157, that change was
free()ing stack memory which causes the program to abort,
and I can no longer make buildworld.
2005-12-01 05:59:45 +00:00
Max Khon
7d81571413 - match_var: do not address memory at invalid address (`len' can be greater
than strlen(var) + 1)
- ReadMakeFile: prevent `fname' memory leak
- ReadMakeFile: prevent double free (caused by double fclose) --
ParsePopInput() closes input file

Reviewed by:	harti
2005-11-30 20:38:03 +00:00
Hartmut Brandt
724b6284e3 Fix the type of the variable 'debug'. It is used as a bitmap, so the
type should be int rather than Boolean.

PR:		bin/84528
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
MFC after:	3 weeks
2005-09-07 07:34:24 +00:00
Hartmut Brandt
527505d8cb The caller of Var_Value() should not change the variable value. Make
this clear by constifying the return value.

Obtained from:	DragonFlyBSD
2005-05-24 16:05:51 +00:00
Hartmut Brandt
19446efc06 Get rid of the third argument to Var_Value() the pointer it pointed
to has always been set to NULL for some time now.

Obtained from:	DragonFlyBSD
2005-05-24 15:58:35 +00:00
Hartmut Brandt
5c86e3c106 Factor out all the .SHELL parsing related stuff into its own file and
rename the function to be consistent with the naming scheme in the rest
of make. No functional changes.

Obtained from:	DragonFlyBSD (idea and most of shell.h)
2005-05-24 15:30:03 +00:00
Hartmut Brandt
940c638f93 Before doing any parsing parse the builtin shell specifications and
set the current shell to DEFSHELL. Put all these specifications into
a list. Add user specified new shells to this list. If the user
just selects one of the already know shells just pick the right one
off the list. This let's one do something like:

# Full specification of the user's shell. This also selects the shell.
.SHELL: name=myshell path=/somewhere/foo echo=loud ...

FOO != bar		# use myshell here

.SHELL: name=sh

BAR != baz		# use /bin/sh here

.SHELL: name=myshell	# no need for full spec here.

# continue to use the user's special shell.
2005-05-24 09:14:46 +00:00
Hartmut Brandt
87c7b797f0 Get rid of global variables for argument vectors produced by brk_string()
introduce a struct that holds all the information about an argument
vector and pass that around.

Author:		Max Okumoto <okumoto@ucsd.edu>
Obtained from:	DragonFlyBSD
2005-05-18 14:50:35 +00:00
Hartmut Brandt
2c050ec33f Make sure machine is initialize before use. Also make two pointers const
to get rid of the last two const warnings.
2005-05-12 15:54:52 +00:00
Hartmut Brandt
059649b9ce Cleanup. Move initialisation of file and program global variables
to top of main() and sort them. Make chdir_verify_path() static - it
is used only here.

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.238)
2005-05-12 15:04:14 +00:00
Hartmut Brandt
1185781977 Replace a lot of Var_Set(..., VAR_GLOBAL) by Var_SetGlobal().
Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.237)
2005-05-12 14:47:22 +00:00
Hartmut Brandt
7007abaf14 Cleanup main(). Move catching SIGCHLD into job.c. Move unsetenv("ENV")
into job.c. Move retrieving of environment nearer to the place where it
is actually used and invert the preprocessor conditionals to use
positive logic.

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.236)
2005-05-12 14:43:32 +00:00
Hartmut Brandt
54a923046f Reshuffle functions to get rid of prototypes.
Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.235)
2005-05-12 14:35:01 +00:00
Hartmut Brandt
7594df85cf Move variable printing from main.c to var.c
Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.233)
2005-05-12 14:31:42 +00:00
Hartmut Brandt
8b8eb9e2ab Fix the fix for bin/72510 applied in job.c:1.70. Actually there have
been two maxJobs variables: one static in job.c and one global used in
main.c and parse.c. Makeing one global out of these was the wrong way
to fix the problem. Instead rename the global one to jobLimit and keep
maxJobs static in job.c.

Suggested by:	rwatson
PR:		bin/72510
2005-05-12 14:16:44 +00:00
Hartmut Brandt
0ec9b6feef Move some global variables to the correct files.
Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.232)
2005-05-12 11:58:39 +00:00
Hartmut Brandt
824060d705 Path_Expand() expects its first argument to be writeable so put the
default system directory into a writeable character array before passing
it to Path_Expand().

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.210)
2005-05-10 14:23:31 +00:00
Hartmut Brandt
a139b7bac1 Move the remaining two prototypes from nonints.h to make.h and
remove nonints.h.

Patch:	7.204
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-05-10 14:10:44 +00:00
Hartmut Brandt
626dc02016 Merge compat.c into job.c. There is a lot in common between these
files and we are going to factor this out.

Patch:		7.199 (slightly changed)
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-05-10 13:45:29 +00:00
Hartmut Brandt
c26295ddea Move Cmd_Exec() from main.c to job.c and fix its prototype. This
results in a warning that will go away soon.

Patch:		7.198
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-05-10 13:18:58 +00:00
Hartmut Brandt
103823e628 Make make a little bit more POSIXish with regard to option parsing:
take everything after -- as either a macro assignment or a target.
Note that make still reorders arguments before --: anything starting
with a dash is considered an option, anything which contains an equal
sign is considered a macro assignment and everything else a target.
This still is not POSIX with regard to the options, but it will probably
not change because it has been make's behaviour for ages.
Add a new function Var_Match() that correctly skips a macro call by just
doing the same as Var_Subst() but without producing output. This will help
making the parser more robust.

Patches:	7.190,7.191
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-05-10 08:06:13 +00:00
Hartmut Brandt
02c3270da1 Split Var_Subst() into two functions: Var_SubstOnly() which substitutes
only one variable and Var_Subst() which substitutes all. Split out the
test whether a variable should not be expanded into match_var().
Make access to the input string consistently using str[]. Remove two
unused functions: Var_GetTail() and Var_GetHead().

Patches:	7.184-7.189
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-05-09 14:06:04 +00:00