Commit Graph

79 Commits

Author SHA1 Message Date
Baptiste Daroussin
8447c44fe7 The dependencies are computed with CC even if sources are C++, when building
when building with an external gcc, we want to be able to pass the path to
the libc++ headers so dependencies are correctly computed for C++ source files.
Add a DEPFLAGS for that purpose

Reviewed by:	imp
2014-10-21 19:56:45 +00:00
Mark Johnston
e9083b2dc5 Fix a few small bugs in the DTrace USDT rules:
* anchor search strings appropriately,
* use .ALLSRC to pass the full path to the D script to dtrace(1),
* don't insert the auto-generated header into SRCS - it doesn't
  accomplish anything, and we end up having to remove it from OBJS anyway.

Reviewed by:		rpaulo
Differential Revision:	https://reviews.freebsd.org/D978
MFC after:		3 weeks
Sponsored by:		EMC / Isilon Storage Division
2014-10-21 04:30:00 +00:00
Mark Johnston
721dae3a52 Correct the way that libelf is linked when USDT is used. 2014-10-01 04:28:39 +00:00
Enji Cooper
41ae64f374 Remove many false positives with make checkdpadd
- Reduce DPADD and LDADD in checkdpadd to -l<foo>
- Skip over -Wl,[es]*-group because -Wl,--end-group and
  -Wl,--start-group might be required to properly link objects (see
  usr.bin/clang/lldb as an example)

This caveat has been present for a while with some components of
the build. However, these false positives were made more more apparent
after r269648.

Phabric: D635
Reviewed by: jmmv (an earlier version)
PR: 192730
MFC after: 2 weeks
2014-09-10 07:55:51 +00:00
Mark Johnston
5439a71566 Define _DTRACE_VERSION in sdt.h rather than setting it manually. This is
similar to what illumos does, and makes it easier to enable USDT probes
in third-party software that doesn't make use of the system makefiles.
2014-09-02 23:43:06 +00:00
Rui Paulo
9c851217b6 Make sure the DTrace header files are built before depend and before
the build starts.

This adds a new variable DHDRS that contains a list of all DTrace
header files.  Then, we use the beforedepend hook to make sure the
heaeder files are built.

Introduce a beforebuild dependency (from projects/bmake) based on
feedback from Simon J. Gerraty.  This lets us generate the header
files without running make depend.

Reviewed by:	sjg, imp
MFC after:	3 days
2014-08-13 01:27:51 +00:00
Rui Paulo
17b227229c Revert r269839.
This doesn't work like I expected and the if clause is never matched.
It turns out that the problem with the older make is unrelated.

MFC after:	3 days
2014-08-11 22:43:44 +00:00
Rui Paulo
8a152f97e7 Add .d files to the reverse matching pattern in bsd.dep.mk to account
for source file dependencies.

This follows the .y and .l behaviour.

MFC after:	3 days
2014-08-11 21:42:06 +00:00
Rui Paulo
6b2edf61bd Fix another typoe in the definition of DTrace SOBJS.
MFC after:	3 days
2014-08-11 21:14:08 +00:00
Rui Paulo
04c241ea2d bsd.dep.mk: use the empty() function with the check for .d files.
Seems to work better with the old make.

MFC after:	3 days
2014-08-11 20:44:57 +00:00
Rui Paulo
23e9784542 Fix an error in the dependency of the DTrace object file.
MFC after:	3 days
2014-08-11 20:41:14 +00:00
Rui Paulo
9b646f2533 Fix a few problems with the USDT probes:
* Include OBJDIR to make sure the generated file is found;
* Simplify the definition of OBJS;
* Add targets for shared objects and for profiled objects.

MFC after:	3 days
2014-08-10 06:43:40 +00:00
Dag-Erling Smørgrav
48b0feca16 Older versions of flex (like the one used in FreeBSD <= 9) expect the
output file name to follow the -o flag immediately, with no intervening
whitespace.

Reported by:	ian@
MFC after:	1 week
2014-07-20 14:49:24 +00:00
Dag-Erling Smørgrav
8f812fec9f Use -o (output to file) instead of -t (print to stdout) and a redirect.
MFC after:	1 week
2014-07-19 14:26:04 +00:00
Rui Paulo
d8b631554e Optimisation: replace ${_D:R} with just ${_D}.
MFC after:	3 weeks
2014-07-12 01:06:29 +00:00
Rui Paulo
ff0f36e773 Automatically build and link DTrace USDT probes.
This completely replaces bsd.dtrace.mk which never worked reliably.

MFC after:	3 weeks
2014-07-12 00:54:34 +00:00
Rui Paulo
9f65e34ff8 bsd.dep.mk: add support for generating DTrace header files from .d files.
MFC after:	3 weeks
2014-07-05 20:08:35 +00:00
Marcel Moolenaar
9e0a344174 Revert r241752. The claim that it's more correct while at the same time
causing a build breakage is interesting to say the least.
2012-10-20 22:44:22 +00:00
Marcel Moolenaar
9120686391 Improve upon the previous commit to fix the yacc rule.
1.  Have the resulting C file depend on the resulting H
    file as it should be. Touch the C file to make sure
    the C file is newer than the H file to keep make
    happy.
2.  Apply the same fix to the other instance of .ORDER,
    missed in the previous commit.
2012-10-19 20:13:08 +00:00
Marcel Moolenaar
0815243c39 Add support for bmake. This includes:
1.  Don't do upgrade_checks when using bmake. As long as we have WITH_BMAKE,
    there's a bootstrap complication in ths respect. Avoid it. Make the
    necessary changes to have upgrade_checks work wth bmake anyway.
2.  Remove the use of -E. It's not needed in our build because we use ?= for
    the respective variables, which means that we'll take the environment
    value (if any) anyway.
3.  Properly declare phony targets as phony as bmake is a lot smarter (and
    thus agressive) about build avoidance.
4.  Make sure CLEANFILES is complete and use it on .NOPATH. bmake is a lot
    smarter about build avoidance and should not find files we generate in
    the source tree. We should not have files in the repository we want to
    generate, but this is an easier way to cross this hurdle.
5.  Have behavior under bmake the same as it is under make with respect to
    halting when sub-commands fail. Add "set -e" to compound commands so
    that bmake is informed when sub-commands fail.
6.  Make sure crunchgen uses the same make as the rest of the build. This
    is important when the make utility isn't called make (but bmake for
    example).
7.  While here, add support for using MAKEOBJDIR to set the object tree
    location. It's the second alternative bmake looks for when determining
    the actual object directory (= .OBJDIR).

Submitted by:	Simon Gerraty <sjg@juniper.net>
Submitted by:	John Van Horne <jvanhorne@juniper.net>
2012-10-06 20:01:05 +00:00
Dimitry Andric
2d12214697 Make sure bsd.dep.mk does not filter out -stdlib=xxx from CXXFLAGS,
since this determines parts of the C++ include path.

MFC after:	1 week
2012-08-23 17:03:33 +00:00
David Schultz
f4b36cb777 Also pass the -ansi flag through to mkdep (requested by bde), and fix
a cut-and-paste-o (noticed by rdivacky).
2011-10-11 05:17:26 +00:00
David Schultz
085f20ec39 Pass -std= flags in CFLAGS to mkdep. Without this, preprocessor tests
for particular compiler features might be evaluated differently by
mkdep than they would be by cc.
2011-10-10 15:39:29 +00:00
Dimitry Andric
58ff0f42ba Remove support for the Intel C Compiler from the build infrastructure.
This support has not worked for several years, and is not likely to work
again, unless Intel decides to release a native FreeBSD version of their
compiler. ;)
2011-04-19 18:09:21 +00:00
Dimitry Andric
6d67f69487 Remove libobjc and other Objective-C related components, as these are
extremely outdated, and not used by anything in the base system.

Silence from:	current@
2011-04-17 21:03:23 +00:00
Rui Paulo
187278cadc For every instance of '.if ${CC} == "foo"' or '.if ${CC} != "foo"' in
Makefiles or *.mk files, use ${CC:T:Mfoo} instead, so only the basename
of the compiler command (excluding any arguments) is considered.

This allows you to use, for example, CC="/nondefault/path/clang -xxx",
and still have the various tests in bsd.*.mk identify your compiler as
clang correctly.

ICC if cases were also changed.

Submitted by:	Dimitry Andric <dimitry at andric.com>
2010-08-17 20:39:28 +00:00
Rui Paulo
efdcc3d8d8 Make sure any -U CFLAGS are not filtered out when calling mkdep, as
gnu/usr.bin/cc/libiberty first defines the PREFIX macro, and then
undefines it again, so mkdep with clang complains.

Submitted by:	Dimitry Andric <dimitry at andric.com>
Reviewed by:	ru
2010-08-17 13:02:08 +00:00
Ruslan Ermilov
213a44479c Allow the CTAGS to be set to something other than "gtags" or "ctags",
but assume it supports a ctags(1)-compatible syntax.

PR:		46676
Submitted by:	Lyndon Nerenberg
MFC after:	3 days
2010-01-18 15:58:02 +00:00
Ruslan Ermilov
2f82e3b16d If CTAGS is not set or set to something other than "ctags" or "gtags",
"cleandepend" was not removing the .depend file; fixed.

PR:		126747
MFC after:	3 days
2010-01-18 15:41:55 +00:00
Dag-Erling Smørgrav
5fb6bed92c Revert CLEANDEPFILES commit per ru@'s request; it does not really solve
the problem.  The correct fix will follow.
2008-02-05 08:52:36 +00:00
Dag-Erling Smørgrav
0d7cc1d0eb Normally, when a header file is removed from the build (as i4b headers
were recently), a simple 'make cleandepend; make depend' is sufficient
to keep the tree buildable after a cvs update when doing incremental
builds.

However, kdump and truss use a script which searches for header files
that define ioctls, and generates C code that includes them.  This
script will usually not need updating when a header file is removed,
so the normal dependency mechanism will not realize that it needs to
be re-run.  One is therefore left with code that references dead files
but will only be removed by a full 'make clean', which defeats the
purpose of incremental builds.

To work around this, modify the cleandepend target in bsd.dep.mk to
also remove any files listed in a new variable named CLEANDEPFILES,
and modify kdump's and truss's Makefiles accordingly.

MFC after:	2 weeks
2008-02-03 11:34:56 +00:00
Kirill Ponomarev
d966048e7e Remove trailing spaces. 2005-01-06 11:12:43 +00:00
Ruslan Ermilov
6260f1d8ee NOTAGS -> NO_TAGS 2004-12-21 09:43:25 +00:00
Tom Rhodes
06d6e4fcfe This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.

The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.

Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.

To use it update share/mk, add
	/usr/local/intel/compiler70/ia32/bin	(icc v7, works)
or
	/usr/local/intel_cc_80/bin		(icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
	CFLAGS="-O2 -ip" CC=icc make depend
	CFLAGS="-O2 -ip" CC=icc make
in it.

Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.

Problems with icc v8:
 - panic: npx0 cannot be emulated on an SMP system
 - UP: first start of /bin/sh results in a FP exception

Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.

Reviewed by:	silence on -arch
Submitted by:	netchild
2004-03-12 21:36:12 +00:00
Ruslan Ermilov
65d2bdc62c Fixed bogus ${FOO:Mbar} tests where the actual intent is to check
if the result set is empty.  While here, replaced non-bogus empty
string comparisons with equivalent empty() checks.
2004-01-27 23:22:15 +00:00
Ruslan Ermilov
6b14fdfa52 Guess better the source for object files in case .depend file is
missing and there are multiple choices using multiple inference
(suffix transformation) rules.

This is known to fix compilation of s_log1p.o in lib/msun on i386,
as otherwise it attempted to use s_log1p.S as the source (which is
marked broken) instead of legal s_log1p.c which is in CFLAGS.  The
normal case where .depend file exists is not affected.

Reviewed by:	bde
2004-01-17 18:51:55 +00:00
Ruslan Ermilov
11dc929821 Introduce DPSRCS, that holds the list of source files which are
needed for generating dependencies.  SRCS are always part of it,
and normally only they.

This can be useful in some random cases where it's necessary to
have something in .depend that isn't part of SRCS.  This will be
used to replace a hack in lib/libpam/libpam/Makefile.
2004-01-13 17:37:45 +00:00
Ruslan Ermilov
484933a925 - Replaced several := ops with their += equivalents; the old
form became unnecessary with the bsd.prog.mk,v 1.69 change.

- Eliminated duplicate y.tab.h in SRCS.

Reviewed by:	bde

- Complementary to the said bsd.prog.mk change, use the fact
  that inner .for loops are not real loops but a tricky form
  of a local macro for the outer loop's variable, and switch
  to using faster variable modifiers to replace extensions.
2004-01-12 15:29:47 +00:00
Bruce Evans
2e3c617921 Use make(1) instead of a shell script to implement the checkdpadd target.
This is simpler, and is easy to do now that make(1) supports substituting
regexps.  Fixed missing '$' anchor in the regexp.  Use less cryptic names
for temporary variables.

Submitted by:	ru (early version)
Reviewed by:	ru
2003-07-03 11:43:57 +00:00
Ruslan Ermilov
6319fd15c9 The .s files do not have to be preprocessed with cpp(1). 2003-07-02 16:43:07 +00:00
Ruslan Ermilov
a51613b6da There's no reason to keep separate AINC knob anymore.
The only real use of it (lib/libc/Makefile) has been
fixed, and if necessary, the contents of AINC should
be added to CFLAGS.

Explained by:	bde
2003-07-01 15:15:45 +00:00
Ruslan Ermilov
ccc4bab104 Added the new variable CTAGS which, if set to "ctags", reverts
to creating the tags file using ctags(1).  Defaults to "gtags".
Made GTAGSFLAGS and HTAGSFLAGS overrideable, added CTAGSFLAGS.
Folded bsd.prog.mk version of `tags' into bsd.dep.mk.

PR:		bin/42852
2002-10-17 13:48:13 +00:00
Peter Wemm
66422f5b7a Initiate deorbit burn for the i386-only a.out related support. Moves are
under way to move the remnants of the a.out toolchain to ports.  As the
comment in src/Makefile said, this stuff is deprecated and one should not
expect this to remain beyond 4.0-REL.  It has already lasted WAY beyond
that.

Notable exceptions:
gcc - I have not touched the a.out generation stuff there.
ldd/ldconfig - still have some code to interface with a.out rtld.
old as/ld/etc - I have not removed these yet, pending their move to ports.
some includes - necessary for ldd/ldconfig for now.

Tested on: i386 (extensively), alpha
2002-09-17 01:49:00 +00:00
Ruslan Ermilov
6e02167b57 Moved checkdpadd target to where it logically belongs. 2002-07-03 12:44:06 +00:00
Bruce Evans
732757a74c Fixed missing quotes in the default for MKDEPCMD in the CC != cc case.
"CC='cc -Dfoo' make depend" was very broken.
2002-05-07 00:15:53 +00:00
Ruslan Ermilov
b25a566d47 Merge bsd.obj.mk's version of the _SUBDIR target with bsd.subdir.mk.
Ensure all standard targets honor SUBDIR.  Now `make obj' descends into
SUBDIRs even if NOOBJ is set (some descendants may still need an object
directory, but we do not have such precedents).  Now `make install' in
non-bsd.subdir.mk makefiles runs `afterinstall' target _after_ `install'
in SUBDIRs, like we do in bsd.subdir.mk.  Nothing depended on the wrong
order anyway.

Fixed `distribute' targets (except for the bsd.subdir.mk version) so that
they do not depend on _SUBDIR; `distribute' calls `install' which already
depends on _SUBDIR.

De-standardize `maninstall', otherwise manpages would be installed twice.
(To be revised later.)
2002-04-23 09:03:56 +00:00
Ruslan Ermilov
5ffdf3618e Prohibit the direct inclusion of bsd.dep.mk. 2002-04-22 10:04:41 +00:00
Ruslan Ermilov
70e82473a4 Doh, previous revision made .depend to be almost always out of date.
Spotted by:	bde

Fortunately, we have a powerful make(1).  Apply some black magic to
make it DTRT.  (Better viewed as diff to revision 1.30.)
2002-04-17 05:42:18 +00:00
Ruslan Ermilov
0cfacc8666 Don't spawn extra make(1) process to execute _EXTRADEPEND. 2002-04-16 12:27:07 +00:00
Ruslan Ermilov
e16529d335 Only pass our idea of `CC' down to mkdep(1) if it's non-default. 2002-04-15 15:23:45 +00:00