Commit Graph

51 Commits

Author SHA1 Message Date
Bryan Drewery
b99a71b1da Fix rescue build after r284356 with STRIP= by using proper STRIPBIN per build(7).
This was causing the following error:

  rescue
  sh: rescue: not found
  *** [rescue] Error code 127

  make[1]: stopped in /usr/obj/usr/src/rescue/rescue

Sponsored by:	EMC / Isilon Storage Division
2015-07-28 21:39:58 +00:00
Tijl Coosemans
19e58304b3 Change -Wl,-r back to -r so gcc doesn't pass --relax to the linker on some
architectures.

PR:		200881
2015-06-15 19:48:28 +00:00
Tijl Coosemans
7a51826c2a Tell the compiler that -dc and -r are linker flags.
Reviewed by:	adrian
2015-06-14 15:40:17 +00:00
Adrian Chadd
8d769a021c Fix typo - this upsets llvm/gcc-4.9, but not gcc-4.2 for some reason. 2015-06-14 00:31:22 +00:00
Adrian Chadd
c1e0b4d15b Fix up crunchgen binary generation to work with external cross-build
tools.

* Allow STRIP to be overridden by the environment
* Use CC to tie things together, not LD

Tested:

* i386, mips32

Submitted by:	kan
2015-06-13 22:01:21 +00:00
Pedro F. Giffuni
2ebed5db20 crunchgen: Permit use of alternative linkers.
Submitted by:	Pete Chou
MFC after:	1 week
2013-02-05 02:57:59 +00:00
Pedro F. Giffuni
997d42d7a7 crunch: Sync some NetBSD changes
Revert a comment that was not supposed to go away.

Obtained from:	NetBSD
2013-02-02 22:39:21 +00:00
Pedro F. Giffuni
96acb2c4fa crunch: Sync some NetBSD changes.
crunchide:
Apr 11, 2009: fix some -Wsign-compare issues.
Sep 20, 1999: Free the right thing.

crunchgen:
Apr 14, 2009: Fix some WARNS=4 issues (-Wshadow -Wcast-qual)
Oct 30, 2004: Add (unsigned char) cast to ctype functions
Feb 5, 2001: fix nested extern.

examples:
Aug 30, 2007: NetBSD 36867 - trsp references are deprecated

Obtained from:	NetBSD
MFC after:	1 week
2013-02-02 21:51:14 +00:00
David E. O'Brien
02c751922e Some amount of style(9)
-- function definitions, header ordering, and $FreeBSD$.
2012-06-27 04:39:30 +00:00
David E. O'Brien
70840a510a Ensure crunchen uses the same make binary as the rest of the build.
Submitted by:	Simon Gerraty <sjg@juniper.net>
2012-06-25 21:56:36 +00:00
David E. O'Brien
b08897254c Run with -B and just .POSIX. 2009-01-31 07:03:36 +00:00
David E. O'Brien
7328f91370 Set .POSIX mode, along with disable parallel mode. Crunchgen parses the
output from make(1) and its picky what it should look like.
Also use make's conditional assignment operator rather than test and set.
2009-01-13 06:52:51 +00:00
John Birrell
51d9ddc635 Back out half of my previous change to support parallel makes.
The generated Makefile clashes with the src/bin/sh/Makefile, causing
it to try to use a rule to build something it doesn't need to.
2006-11-27 01:35:11 +00:00
John Birrell
80f498e559 Fix another parallel make problem with the generated make file.
Define the xxx_OBJPATHS earlier and then use it in the xxx_make
target because each obj is actually made through that.

This allows the crunch to work with -j32 on sun4v.

The makefile generated is still poor, though. It really shouldn't use
the general 'make all' to do the submakes in the app directories being
crunched because each of those objects is listed as a dependency in
the generated crunch makefile. Doing that really requires a unique rule
to generate them.
2006-11-24 03:56:25 +00:00
John Birrell
e8a1d46e97 Add the SUBMAKE_TARGETS (like ppp_make) to the dependency list
for linking the crunched app so that when a parallel make is run
(like -j32 on sun4v), the link waits for the sub-make processes
to complete.
2006-11-22 07:52:14 +00:00
Ceri Davies
55f92f6465 Commands like gmirror, graid3, ... and others which use dlopen() to load
classes from say, /lib/geom, cannot be statically linked completely.
Moreover, those shared objects may require other shared objects (i.e.
 for geom, libraries like -lmd, -lcrypto).

The libs_so extension to crunchgen fixes this by allowing some libraries
to be linked in dynamically.  This requires that a copy of rtld and the
shared libraries be made available to the crunched binary, and so is not
suitable for all environments.  Crunchgen configurations which do not
use the 'libs_so' keyword are unaffected and produce identical binaries
with and without this commit.

Approved by:		murray (mentor, in spirit), jhb
In collaboration with:	Adrian Steinmann <ast at marabu dot ch>
MFC After:		6 weeks
2005-12-23 15:31:37 +00:00
Ruslan Ermilov
951e4d1c91 In crunchgen(1), when calling make(1), don't redirect stderr to stdout,
just rely on the exit status to detect an error.  This makes crunchgen(1)
safe to use with certain make(1) debugging flags.

MFC after:	1 week
2005-01-20 10:49:03 +00:00
Hartmut Brandt
a8595b6640 Fix a 4.X -> 5.X upgrade problem: crunchgen used to emit a line 'MAKE=make'
or 'env MAKEOBJDIRPREFIX=... make' depending on the setting of
MAKEOBJDIRPREFIX in the environment. In any case this line kills the
original value of ${MAKE}. When during buildworld a new make is built (as
is the case during the upgrade) this causes a wrong make to be picked up
(the first one in the path). Use the same technique as Makefile.inc1:
create a MAKEENV variable and a CRUNCHMAKE that calls ${MAKE} with that
MAKEENV prefixed. Use CRUNCHMAKE instead of MAKE throughout the generated
makefile. This leaves the original ${MAKE} undisturbed.
2004-08-09 19:18:19 +00:00
Ruslan Ermilov
2343a53401 The second chdir(1) that I trimmed is needed too
if the program has an object directory.

Explained by:	Tim Kientzle <kientzle@acm.org>
2003-04-23 04:28:35 +00:00
Ruslan Ermilov
7cc7315cfb chdir(1) into a source directory before attempting to determine the
OBJS list.  This is needed to crunch any program that relies on the
correct .CURDIR setting, e.g. src/bin/csh.

Submitted by:	Tim Kientzle <kientzle@acm.org>
2003-04-22 14:01:33 +00:00
Luigi Rizzo
252f13ab51 Add a "special progname lib xxx ..." command to crunchgen
so the .lo files can be partially linked against libraries
which redefine symbols in the standard libs, or which reference
symbols in the objects.

Submitted by: Sam Leffler
MFC After: 3 days
2002-03-30 16:48:30 +00:00
Josef Karthauser
1554755e12 Make source crunches work as well as object crunches; broken in the
last commit that fixed object crunches.

Repeat after me, "no excuses for not testing".
2001-08-17 11:11:10 +00:00
Josef Karthauser
11384533ea Make crunchgen crunch pre-built object files again, i.e.:
progs prog1
    special prog1 objdir ../../prog1/obj
    special prog1 objs prog1.o

This fixes a bug that I introduced around the time of 4.2-release.

Reported by:	Larry Baird <lab@gta.com>
2001-08-15 14:37:26 +00:00
Josef Karthauser
d1a97625be Use 'LIBS+= ...' instead of 'LIBS= ...' in the generated makefile
so that the user can override libraries at build time.  This is
makes it easier to cross-compile crunch builds.

Suggested by:	luigi
MFC after:	3 days
2001-06-20 23:21:02 +00:00
Ruslan Ermilov
a0bac7e013 - Call subclean' after clean' for each program.
- Eliminate compiler warning.
2001-04-04 08:26:54 +00:00
Ruslan Ermilov
42037fc8b4 `buildopts' may affect the selection of object files.
Make sure we pass $(BUILDOPTS) to the `clean' target
so that `make clean' works on the same set of object
files.  Otherwise, we may end up with an incorrectly
built and up-to-date object file.
2001-03-30 08:04:25 +00:00
Josef Karthauser
87eb4a4220 Liberal application of style(9). 2001-01-10 14:08:48 +00:00
Josef Karthauser
617b818021 Flag an error and remove the program from the list if there is
no source directory or no objects can be determined.

Initialise a structure variable.
2001-01-10 13:27:38 +00:00
Josef Karthauser
e3b7d1782a Clean up the source directory finding code, and in the process fix a
problem that occurs when a program's source isn't found.
2000-12-24 12:21:15 +00:00
Josef Karthauser
61ffadb185 Use one of the TMPDIR env variable or _PATH_TMP instead of hardcoding
/tmp.

Submitted by:	jedgar
2000-12-17 19:49:07 +00:00
Josef Karthauser
15d6ae10ad Avoid potential problems with the existance of a shadow obj directory
confusing the 'make -f tmpfile' in the tmpfile, by creating it in /tmp.
2000-12-17 17:07:40 +00:00
Josef Karthauser
5e5f382630 Clarify an ambiguous 'else' introduced by a recent commit. 2000-12-17 17:03:05 +00:00
Josef Karthauser
f3c47f54c6 o check strdup() return values
o strcpy() -> strlcpy()
o sprintf() -> snprintf()
o mktemp() -> mkstemp()
o use err() instead of errx() in out_of_memory() function since
  errno will probably be set

Submitted by:	jedgar
2000-12-17 16:51:00 +00:00
Josef Karthauser
843d8d5178 Hopefully the last patch in a series to try and teach crunchgen to
handle MAKEOBJDIRPREFIX better, in conjunction with the -o and -p
flags.
2000-12-17 16:13:23 +00:00
Luigi Rizzo
019d04d147 Make crunchgen aware of obj directories. Formerly it had
/usr/obj hardwired in the code, now you can override it
with a command line option or MAKEOBJDIRPREFIX env. variable.
The above is useful to build picobsd-specific objects in some other
place than /usr/obj

While at it, fix documentation and change a few sprintf -> snprintf.
2000-11-30 21:14:54 +00:00
Josef Karthauser
08a15190ad Add and document a new configuration command: buildopts.
This allows global make options to be specified within the crunch
configuration file.
2000-11-15 14:33:29 +00:00
Josef Karthauser
34944d4885 Define a new special type: buildopts.
This allows build flags to be specified for a particular program from
within the crunch.conf file, eg:

	prog ppp
	special ppp buildopts -DNOKLDLOAD -DNOINET6 -DNONAT -DNOATM

This adds '-DNOKLDLOAD -DNOINET6 -DNONAT -DNOATM' to make targets
related to ppp when determining which object files to build and
when calculating dependencies and building the targets.
2000-11-10 15:21:37 +00:00
Josef Karthauser
ba2250ddb7 Cause prog_make targets to include a ``make obj'' rule if the -o flag
is given to crunchgen.
[ This fixes the previous commit which silently added ``make obj'' ]
2000-11-03 15:48:58 +00:00
Josef Karthauser
65cb078f16 A missing feature of crunchgen was the ability to supply make options on
a per program basis.

This has now been added in the following way:

* Harness the make header file that's specified with the -h argument:
  - Allow the user to define $(OPTS) to specify make arguments that should
    be added to every program target.
  - Allow the user to define $(prog_OPTS) to specify make arguments that
    should just be added to the build of 'prog'.

* Make sure that $(OPTS) and $(prog_OPTS) are defined when looking through
  each program's make file to determine which object files to crunch.

* When building the crunchgen makefile add $(OPTS) and $(prog_OPTS)
  to the depend and build rules for $(prog_OBJS).
2000-11-03 15:35:27 +00:00
Luigi Rizzo
08826cadb2 Add a few features to crunchgen to simplify the use of existing
makefiles (for use with picobsd among other things).
See the manpage for details, but:

  * -h makefile-include-name
        can be used to specify a file to include in the makefiles
        generated by crunchgen . This is a good place to specify make
        variables such as RELEASE_CRUNCH, NOTHIS, NOTHAT and the like.

  * special progname objvar variable_name
        in the crunch config file declares a different variable than
        OBJS to be used to get the list of objects.

  * crunchgen now looks first for Makefile.<progname> in the current
    directory to override the makefile in <progname> source dir.
    This in many cases avoids the need to patch the original makefile
    if the above two features are still not enough.

Approved-By: jordan
2000-02-05 10:29:19 +00:00
Jordan K. Hubbard
6cd35234a0 Assume ELF-style symbol names now.
Submitted by:	jhay
1998-09-14 11:33:38 +00:00
Søren Schmidt
f5dee08294 Use /bin/pwd instead of a potentially shell builtin that does
not return the "real" path.
This makes it possible to have the .o files put in the /usr/obj
hierachy instead of in the /usr/src one.
1998-01-22 19:34:31 +00:00
Brian Somers
ced716c30f Remove the necessity of -ldes and -lalias etc from release/Makefile.
When building a release, RELEASE_CRUNCH is defined for a `make' of
the objects required by the crunch of each program.  The object list
is still obtained in the same way, so you must make sure that all
objects are built (empty if necessary) by this make.  ppp/Makefile
provides an example.

Reviewed by: jkh
1998-01-17 14:21:21 +00:00
Joerg Wunsch
42ac3bf16a Add a new special called `keep' to the list of special options. It
provides for a means to specify an argument for crunchide's -k option.
(This is required by ntpdate.)

Submitted by:	peter@rhiannon.clari.net.au (Peter Hawkins)
1997-10-05 13:35:05 +00:00
Philippe Charnier
b17e90a9c9 Use err(3). 1997-09-15 06:41:09 +00:00
Joerg Wunsch
eb14881596 Initialize memory obtained by malloc().
Detected by: phkmalloc -AJ
1996-11-16 22:49:02 +00:00
Poul-Henning Kamp
154fd6a990 Enhance crunchgens understanding of our new /usr/obj/pwd strategy. 1996-08-04 20:38:53 +00:00
Poul-Henning Kamp
d9d5922eec Make crunchgen match the new obj/ convention. 1996-07-15 11:20:21 +00:00
Rodney W. Grimes
709e8f9ae1 Remove trailing whitespace. 1995-05-30 03:57:47 +00:00
Poul-Henning Kamp
fb7f926e3d Add a '-l' option, which lists the argv[0]'s we will respond to. This will
simplify the src/release Makefile quite a bit.
1995-02-25 07:25:31 +00:00