Commit Graph

106 Commits

Author SHA1 Message Date
rillig f1132483d6 make(1): remove unused strlist_t 2020-10-25 13:25:19 +00:00
rillig 6f608deec1 make(1): add target-specific COPTS when generating cpre or casm 2020-10-23 15:44:38 +00:00
rillig 587ff3c418 make(1): fix GCC warning about small buffer for cohort_num
Since unmade_cohorts is a signed number (the code contains an underflow
check), the result of the '%' operator could be negative and result in
"#-999999", which would overflow the buffer, truncating the last digit.
2020-10-18 19:11:35 +00:00
rillig ce82f0970c make(1): enable format string truncation warnings for parse.c
No node is ever going to have a million or more cohorts.  And even if
there were, this name is only used for printing informational messages.
2020-10-05 22:15:45 +00:00
rillig f336e55bc4 make(1): revert previous commit
It had accidentally reverted all the work from the past few days.
2020-10-05 19:27:47 +00:00
rillig b6c0384ff9 make(1): fix double-free bug in -DCLEANUP mode (since 2020-10-02)
The bug had been introduced with dir.c 1.155 on 2020-10-02 22:20:25.  In
that commit, openDirectories was replaced with a combination of a list
with a hash table, for more efficient lookup by name.

Upon cleanup, OpenDirs_Done is called, which in turn called
Dir_ClearPath.  Dir_ClearPath takes full ownership of the given list and
empties it.  This was no problem before since afterwards the list was
empty and calling Lst_Free just frees the remaining list pointer.

With OpenDirs, this list was combined with a hash table, and the hash
table contains the list nodes, assuming that the OpenDirs functions have
full ownership of both the list and the hash table.  This assumption was
generally correct, except for the one moment during cleanup where full
ownership of the list was passed to Dir_ClearPath, while the hash table
still contained pointers to the (now freed) list nodes.  This by itself
was not a problem since the hash table would be freed afterwards.  But
as part of Dir_ClearPath, OpenDirs_Remove was called, which looked up
the freed directory by name and now found the freed list node, trying to
free it again.  Boom.

Fixed by replacing the call to Dir_ClearPath with code that only frees
the directories, without giving up control over the list.
2020-10-05 19:24:29 +00:00
rillig 41b60e14d8 make(1): allow easy creation of preprocessed source and assembler
To be used during development, to see how changes in the source code
affect the generated machine code.
2020-10-05 15:11:37 +00:00
rillig 8d45a60e32 make(1): remove filemon object files on clean 2020-09-01 17:12:30 +00:00
rillig 1b001ba380 make(1): fix compilation with GCC 8 2020-08-31 16:41:19 +00:00
rillig 90a952c9c5 make(1): fix copy-and-paste mistake for compiling with GCC10 2020-08-31 06:44:12 +00:00
rillig ae6246b519 make(1): remove redundant MAKEFLAGS from subdir make
The make flags are passed via the environment, not via the command line.
This is not as obvious and visible, but it works.
2020-08-28 20:57:54 +00:00
rillig 5be8116c2e make(1): pass the command-line variables to the subdir make 2020-08-27 19:09:37 +00:00
rillig ca993cd932 make(1): remove header sprite.h
Make is independent of the Sprite operating system.
2020-08-26 23:00:47 +00:00
rillig 1366bfb67d make(1): allow custom build options 2020-08-25 16:39:19 +00:00
rillig 95444f19ea make(1): allow to run only selected tests via the command line 2020-08-23 17:22:52 +00:00
sjg 2c3b0a985a Use TEST_MAKE to run unit-tests
This lets us take advantage of new features like ${.SHELL}
2020-08-22 20:50:43 +00:00
rillig 2ea44cf014 make(1): don't optimize when measuring the code coverage
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96622
2020-08-19 06:30:37 +00:00
rillig a0145b6eae make(1): fix archive test
Even though it is commented out in this Makefile, it is still run by
atf, on purpose.  This test is broken on FreeBSD, but on NetBSD it
should still be run.

Without removing the archive first, it could be left over from a
previous test failure and thus be newer than all its members, leading to
${.OODATE} being empty.
2020-08-15 01:49:07 +00:00
rillig 5a58c0c483 make(1): enable -Wcast-qual for var.c again
When it became disabled 9 years ago, there were 15 instances of UNCONST
in the code.  These have been removed in the latest cleanup sessions.

Tested with GCC 5 from NetBSD 8 and GCC 10 from pkgsrc.
2020-08-12 19:21:05 +00:00
rillig 6910f1eeb2 make(1): allow optional compilation with GCC 10, use gcov from GCC 2020-08-12 18:48:36 +00:00
rillig fb967d0eb7 make(1): make gcov command line configurable
Some useful options are -a or -f.
2020-08-10 18:40:24 +00:00
rillig 731db6505d make(1): clean up coverage files even if USE_COVERAGE is not set 2020-08-10 18:20:28 +00:00
rillig 5f58857059 make(1): allow to build using GCC 9 during development 2020-08-09 05:51:04 +00:00
rillig 619278f158 make(1): add more detailed debug logging for variable modifiers
Before a modifier is applied to a variable, it is not yet parsed,
therefore it is only possible to log a rough estimate of the modifier.
But after applying it, the parsing position has advanced, and the full
modifier can be logged.

In addition, to fully understand how the modifiers work, it's not enough
to just know the variable names and values, there are also some flags
that influence how the modifiers behave.  The most influential is
VARE_WANTRES.

Thanks to sjg for the extensive review and valuable feedback on the
first drafts.
2020-08-08 13:50:23 +00:00
rillig 9e214e56ad make(1): one file per line in the Makefile
Suggested by sjg.
2020-08-07 05:13:04 +00:00
rillig 237062f441 make(1): revert previous commit; "make retest" was already possible
What I really meant to allow was to run "make sync-mi" directly from the
main directory.  But adding that to TARGETS didn't do anything.
2020-08-06 05:32:26 +00:00
rillig 10728724ed make(1): allow "make retest" directly from the main directory 2020-08-06 05:27:31 +00:00
rillig 86abf69ed1 make(1): no declaration-after-statement anymore
NetBSD make is intended to be maximally portable, therefore it uses only
C89.  This was not declared in the Makefile before.

There are still a few places in parse.c and metachar.c that use
end-of-line comments.  These will be fixed in a follow-up commit.
2020-08-03 20:26:09 +00:00
rillig 6561256dad make(1): remove line numbers from generated code coverage files
The line numbers make it difficult to spot changes in the code and
coverage if a line is added or removed from the code.
2020-08-01 21:48:17 +00:00
rillig ebaa3a3702 make(1): fix undefined behavior in malformed :S modifier
The unit tests failed on Ubuntu, and by looking closely at the code, it
was trivial to see the out-of-bounds memory read.

Other modifiers may have the same problem and will be inspected later.
2020-07-31 07:29:21 +00:00
rillig 0513211916 make(1): use specialized return type for ApplyModifier functions
This makes it immediately obvious what happens after a modifier has been
applied, instead of having to translate single-character mnemonics or
booleans to their actual intention.

This also reduces the size of the binary since there are fewer jumps.
2020-07-29 20:57:31 +00:00
rillig cfbb88abcf make(1): explicitly add dependencies on headers
This prevents partial builds after changing a header.  The declared
dependencies are more than strictly necessary, but that's still better
than having inconsistent partial builds because too few dependencies are
declared.
2020-07-26 20:04:57 +00:00
rillig e2fa3539dd make(1): condense the list library into a single file
The list library is only used in make(1). Having it spread out over 28
files made it look more complex than it really is. In fact, it's just a
versatile generic data type like in hash.c.

Having all the list functions in a single file reduces the code size,
both by omitting the many RCS Ids and by inlining commonly used code.
2020-07-26 07:15:26 +00:00
rillig a59c2e0bf8 make(1): make it easy to run gcov on the code
There seems to be no gcov support in share/mk yes, but it's still good
to have, especially for a complex program like make(1).
2020-07-25 21:00:48 +00:00
rillig 46a8a1ff28 make(1): indent Makefile directives like in pkgsrc
This makes it easier to see the corresponding .if/.endif, even without
comments.
2020-07-25 20:50:00 +00:00
rillig 1dc61dc46a make(1): format Makefile consistently 2020-07-25 20:44:50 +00:00
rillig 8b2b420ad3 make(1): regroup source files 2020-07-25 20:41:58 +00:00
sjg ee757927d0 Fix meta_compat mode.
We need to call meta_job_output() from meta_compat_parent()
Also, the need for extra fds for meta mode only applies when
using filemon_ktrace.c.
Since we hope to see more interfaces like that, test for
USE_FILEMON_DEV being not defined.

Reviewed by: riastradh
2020-02-06 01:13:19 +00:00
riastradh e3921a1b91 Tweak makefile for USE_FILEMON=dev, from sjg. 2020-01-19 19:50:54 +00:00
riastradh bea0f8c176 Per sjg's suggestion, split filemon API into separate back ends.
By default we use the ktrace back end, but the /dev/filemon back end
is available as a compile-time option, by setting USE_FILEMON=dev in
make.  sjg raised concerns about ktrace performance and would like to
continue using /dev/filemon on FreeBSD (which has seen more
maintenance kernel-side) without forking make.
2020-01-19 19:49:36 +00:00
riastradh 1378959eea Reimplement make(1) meta mode without filemon(4). 2020-01-19 19:42:32 +00:00
maxv 2a5d072bf2 Revert the filemon removal in bmake, as pointed out by maya we do care
about not introducing divergence with FreeBSD, and the cost of unused
is acceptable here.
2019-12-19 07:14:07 +00:00
maxv e67f51b8f7 Retire filemon, discussed on tech-kern@. 2019-12-18 07:37:17 +00:00
mrg de11d87641 introduce some common variables for use in GCC warning disables:
GCC_NO_FORMAT_TRUNCATION    -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION  -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW    -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE   -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints.  many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
2019-10-13 07:28:04 +00:00
mrg 21303c93e9 convert HAVE_GCC == 7 to HAVE_GCC >= 7. 2019-09-29 23:44:58 +00:00
mrg a0193bc54d - use -Wno-error=format-truncation 2019-02-04 03:58:41 +00:00
christos 2357fc5dd5 use SUBDIR.roff suggested by uwe@ 2018-06-10 17:55:11 +00:00
sjg 3c092045e1 Adapt to changed Var_Subst() 2016-02-18 20:33:40 +00:00
christos 9beb5dadf3 Centralize the "is a meta char" test, instead of using two different arrays. 2015-06-17 17:43:23 +00:00
dholland c3ab26950f Rework /usr/share/doc.
Update the <bsd.doc.mk> infrastructure, and update the docs to match
the new infrastructure.

- Build and install text, ps, pdf, and/or html, not roff sources.

- Don't wire the chapter numbers into the build system, or use them in
the installed pathnames. This didn't matter much when the docs were a
museum, but now that we're theoretically going to start maintaining
them again, we're going to add and remove documents periodically and
having the chapter numbers baked in creates a lot of thrashing for no
purpose.

- Specify the document name explicitly, rather than implicitly in a
path. Use this name (instead of other random strings) as the name
of the installed files.

- Specify the document section, which is the subdirectory of
/usr/share/doc to install into.

- Allow multiple subdocuments. (That is, multiple documents in one
output directory.)

- Enumerate the .png files groff emits along with html so they can be
installed.

- Remove assorted hand-rolled rules for running roff and roff widgetry
and add enough variable settings to make these unnecessary. This
includes support for
   - explicit use of soelim
   - refer
   - tbl
   - pic
   - eqn

- Forcibly apply at least minimal amounts of sanity to certain
autogenerated roff files.

- Don't exclude USD.doc, SMM.doc, and PSD.doc directories from the
build, as they now actually do stuff.

Note: currently we can't generate pdf. This turns out to be a
nontrivial problem with no immediate solution forthcoming. So for now,
as a workaround, install compressed .ps as the printable form.
2014-07-05 19:22:02 +00:00