Commit Graph

57 Commits

Author SHA1 Message Date
christos 5eb3a1ebce Add -v VARSPEC, so that we can pass variable assignments to make(1) 2004-08-19 22:24:04 +00:00
christos 999ef51181 remove copyright and comment sections. Saves ~40K on the crunched
ramdisk binary.
2004-06-06 01:46:53 +00:00
jmc 6cf7ed4ade Fix PR#4980 and support common symbols correctly in crunched programs.
Exclude them from renaming and expect the linker to do the right thing in
resolving them all to the library copy (i.e. optarg) or locally as the
case may be. Testing multiple programs crunched which reference optarg shows
correct behavior now.
2003-12-28 09:21:36 +00:00
jmc c392dc52fe Support crunch configs which specify relative srcdir's but don't use -D. For
these cases, prepend getwd() onto the front of them so a full correct path
is passed to the reach over make command (as it's running from at least
a subdir of the current directory for each object)
2003-12-27 22:28:38 +00:00
dmcmahill e399647d5d Use grep in favor of egrep in a few places. The pattern being searched
for is just a string and some egrep's (notably the Solaris one) don't like
the -w option.
2003-12-08 23:57:13 +00:00
nathanw 31bbd833a9 Change the make(1) command lines generated by crunchgen from:
"make -a -b VAR=VALUE -c -d target" to
"make -a -b -c -d VAR=VALUE target"

to avoid depending on make's undocumented and unportably-implemented
handling of the former case.

Makes crunchgen and nbmake work together on Cygwin.
2003-11-19 22:44:15 +00:00
lukem 171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

    *	Consistently move the inclusion of nbtool_config.h to before
    	<sys/cdefs.h> so that the former can provide __RCSID() (et al),
    	and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
	#if HAVE_NBTOOL_CONFIG_H
	#include "nbtool_config.h"
	#endif
to the top of the source files (for the general case).
2003-10-27 00:12:41 +00:00
lukem 53a9d2856c fix typo that prevented ${PROG}.unstripped from being removed in "clean" 2003-10-07 07:08:20 +00:00
dsl 9778762a60 Keep unstripped binary in $OBJ, use are timestamp instead of prog.stripped.
Patentially useful as a source of symbol information for debugging.
2003-07-09 19:51:07 +00:00
thorpej d6c02b1523 "objcopy --redefine-syms-file" is now "objcopy --redefine-syms". 2003-06-01 02:03:22 +00:00
dsl cd7432d0cb Add an extra target to the xxx.mk file that is equivalent to 'all', but which
doesn't pick up baggage from bsd.own.mk and bsd.prog.mk.
This stops parallel makes exploding because they try to build ${PROG} to soon.
Fixes toolchain/21563 (with change to src/distrib/common/Makefile.crunch).
Upped version of crunchgen to 0.3
2003-05-15 17:49:46 +00:00
dsl 606b795c6a Add a .WAIT to ensure that all the program objects are built before
trying to build the crunched binary.
Might fix toolchain/21563
2003-05-14 11:20:01 +00:00
dsl 13d371ab4c Make the prog.mk makefile run make in each of the target directories and
then build the program itself.
This means that changes to any of the program source files cause the
crunched binary to be rebuilt.
Seems to work ok with the sysinst ramdisks.
2003-05-09 12:10:15 +00:00
fvdl 083af7aab4 Back out rev 1.43 for now, it seems to create some new problems (see
the sysinst Makefile).
2003-03-18 01:30:54 +00:00
enami 3d76616fbe No need to invoke the make command so many times. It can handle all
the target specified in command line.
2003-03-01 08:36:05 +00:00
msaitoh f81acfd9b4 The name of the working directory for each prog is converted by "s/-/_/".
The directory list to be removed (i.e. make clean) has to be set with
the converted name.
2003-02-18 18:12:07 +00:00
simonb 6960865826 Use new the --redefine-syms-file option to objcopy to rename the symbols
we want to hide instead of making global symbols local (which doesn't
work on MIPS).
2003-01-29 10:32:34 +00:00
lukem 951972b555 - move LDSTATIC=-static to the bottom, so that "LDSTATIC=" in /etc/mk.conf
doesn't cause lossage
- set NOMAN= at the top (rather than MKMAN=no)
2002-08-20 01:52:58 +00:00
pooka ade9640026 Add -o, -D, and -L to usage() to get it in sync with reality. 2002-07-09 12:49:10 +00:00
lukem f5aa03d2fa revert revision 1.37; it causes problems when running make(1) on a
crunchgen-created makefile with a partiallly complete build
(a situation which is more common than you think...)

solving the "parallel build" problem for crunchgen-created makefiles
needs to be done a different way...

fixes [toolchain/17012] from me.
2002-05-29 09:41:51 +00:00
sommerfeld 508e207b01 Some tweaks to (hopefully) make the crunchgen-generated makefile
parallel-build-safe.
2002-05-02 21:18:31 +00:00
sommerfeld 128f7ba0f7 Invoke the "make crunchgen_objs" submake with -B so we aren't confused
if we're being invoked in the context of a parallel build.
2002-04-29 04:20:56 +00:00
lukem 9aa4b4fe5d Move tempfname[] to fillin_program_objs() (the only place that calls it),
and assign it before each use of mkstemp(3).
Problem noted by Ben Harris <bjh21@netbsd.org> in [toolchain/16140].
2002-03-31 08:02:08 +00:00
lukem 1cdb82d0a7 Use "r" instead of "r+" to popen(3), since the latter is not portable
and the I/O stream is only read from in any case. Problem noted and fix
suggested by Ben Harris <bjh21@netbsd.org> in [toolchain/16139].
2002-03-31 07:48:15 +00:00
lukem 2321ad750f CRUNCHEDPROG=1 is a bit more useful if it's also defined when
determining prog_OBJPATHS ...
2002-02-02 12:25:35 +00:00
lukem ab2c3dcd21 pass CRUNCHEDPROG=1 to make(1) when building progs from their Makefiles.
allows different options for programs that are being crunchgen(3)ed.
2002-02-02 12:14:41 +00:00
tv 554a73a4ce Include config.h for host tool; protect __RCSID. 2002-01-31 19:24:47 +00:00
ragge a8858d3140 Add special command "keepsymbols", allows the specified external symbols
not to be hidden. From Jens Nilsson, jens@rockstorm.se.
2002-01-25 12:05:00 +00:00
jmc edf781f5fc Oops...don't nuke the global symbols with objcopy. Just keep the crunched stub
and revert the others to locals
2001-11-08 07:35:00 +00:00
drochner ae7b2f469f remove superflouos arguments to fprintf() 2001-11-07 18:22:39 +00:00
christos 3058ad6190 make sure that we ramdiskbin is static. By the numbscull! Nobody tested this?
BTW. it seems that only make working floppies with USETOOLS=no. Will
investigate more.
2001-11-07 04:48:07 +00:00
jmc 0fbad14c98 Check for MAKEFLAGS in the env and pass those to the test make's run for
finding obj files. Otherwise -m <new mk files> won't get passed and can
cause problems on some cross builds.
2001-10-21 23:06:59 +00:00
jmc 6addac288f If USE_NEW_TOOLCHAIN is defined use objcopy instead of crunchide as it works now. 2001-10-05 22:52:56 +00:00
jmc ab4dcdab07 Convert makefile to use bsd.prog.mk. Makes linking work since the .mk file
takes care of it and this will handle a DESTDIR build setup then.
2001-10-04 07:34:47 +00:00
jmc 03648a201b Add a -d option to set the DBG flag to whatever flags the builder wants. If
it's not set, default to -Os (so it's not hard coded into the binary.)

Generate a makefile by default that does all object file builds in local
subdirs by binary (i.e. bad144 gets built in $OBJDIR/bad144) via a reach over
make. (Sets .PATH and .CURDIR and does a make for the objects needed in that
dir).

Add a -o option that does the old behavior of searching for obj files by
querying the various object environment vars and searching. Without this
option none of the objdir special options, environment vars, etc will have
effect.

Document all the changes in the man page (and specificly note that without -o
none of the objdir functions take effect).
2001-10-04 04:17:04 +00:00
tls 5cb98b6cb9 Fix some lossage in previous commit: don't remove everything when cleaning
in a source directory, just the object files.  This is a _very temporary_
fix; I will untangle the meaning of UPDATE, etc. in this context presently.
2001-09-24 01:05:47 +00:00
tls 0b6a2936aa Changes to the emitted makefiles that actually build the objects:
1) Always do a make clean before building objects in any directory.  This
   is wasteful, but there's really no other simple way to cope with the
   fact that the compilation settings (e.g. CFLAGS) appropriate for the
   non-crunched build of a program may not be appropriate for the crunched
   build.  If the objdir magic in make didn't rely upon the presence of an
   "obj" or "obj.${MACHINE}" symlink, we could abuse it to handle this but
   unfortunately, it does.

2) Override $DBG to cause object files to be built with -Os.  We can't emit
   "DBG?=" into the generated makefile because of order-of-inclusion issues
   with the system Makefiles; the result would be that the default setting
   (currently -O2) would always be used instead of -Os.  If you're crunching,
   you almost certainly are doing it to get a smaller executable (!) so -Os
   is almost certainly appropriate for you.
2001-09-24 00:40:35 +00:00
christos 35d2e40e99 fix nested extern 2001-02-05 01:39:27 +00:00
garbled 35e9659b6d change the direct call to crunchide to ${CRUNCHIDE} 2000-11-01 07:16:02 +00:00
garbled 331c044669 Modify this to obey $MAKE in the environment, instead of allways calling
"make" hardcoded.  This should cause my cross-ramdisk-builds to stop
blowing a gasket.
2000-10-30 09:55:09 +00:00
matt a28f4d4751 Teach crunchgen.c about MAKEOBJDIRPREFIX. 2000-09-08 17:20:47 +00:00
mycroft 886d104ff1 Fix uninitialized structure element. 2000-06-11 14:31:11 +00:00
simonb d88dfea295 Don't declare 'extern opt*' getopt variables. 2000-04-14 06:11:07 +00:00
mycroft 5086341bbf Don't try to use /tmp/Makefile... 2000-01-24 18:07:54 +00:00
sommerfeld dd51978a5a Make rules for finding object directory match those used by make:
obj.${MACHINE} takes precedence over obj.
the generated makefile should probably just use the print-objdir hack instead.
2000-01-09 16:37:28 +00:00
tsutsui 5cb06e6456 Use uname(3) to determine MACHINE type. 2000-01-09 04:54:53 +00:00
cgd 7c91150061 put temporary file in /tmp, and cd into src dirs and make w/ "Makefile"
(rather than making w/ "srcdir/Makefile") so that relative path specs in
srcdirs work out correctly.
1999-06-21 05:57:10 +00:00
wrstuden ad4097b67b Generate a makefile which is cross-crunching compatabile:
1) Include bsd.sys.mk so we pick up DESTDIR changes to fine .h files.
2) Only set STRIP if it's unset.
3) Generate .cro files rather than .lo files. .lo now is used for "local
	objects" - obj's for the host machine not the target machine.
1999-05-06 18:40:39 +00:00
wrstuden 67db0c4b38 Teach crunchgen to play nice in a cross-compiling environment. Make
the machine type a run-time decision a la make. Also, use ${LD}
for the linker, not ld.

Note: you will have to delete the crunchgen cache file for these
changes to take effect.
1998-09-13 05:32:18 +00:00
mycroft 519d858510 __AUDIT__ cleanup. 1998-07-28 19:22:54 +00:00