Commit Graph

233 Commits

Author SHA1 Message Date
erh 552531a249 Also support per-program LDFLAGS and LDSTATIC. 2003-09-13 03:44:20 +00:00
erh 056a75c41e Create a way to add additional flags to COPTS, CPPFLAGS, CXXFLAGS and LDADD
for particular libraries or programs by specifying the additions in mk.conf
instead of needing to go edit individual Makefiles.
2003-09-13 02:52:05 +00:00
lukem 40a8a5734e Support ${LDFLAGS} when linking libraries 2003-08-24 09:35:49 +00:00
lukem a93ea220fc Rework how dependency generation is performed:
* DPSRCS contains extra dependencies, but is _NOT_ added to CLEANFILES.
  This is a change of behaviour.  If a Makefile wants the clean semantics
  it must specifically append to CLEANFILES.
  Resolves PR toolchain/5204.

* To recap: .d (depend) files are generated for all files in SRCS and DPSRCS
  that have a suffix of: .c .m .s .S .C .cc .cpp .cxx

* If YHEADER is set, automatically add the .y->.h to DPSRCS & CLEANFILES

* Ensure that ${OBJS} ${POBJS} ${LOBJS} ${SOBJS} *.d  depend upon ${DPSRCS}

* Deprecate the (short lived) DEPENDSRCS


Update the various Makefiles to these new semantics; generally either
adding to CLEANFILES (because DPSRCS doesn't do that anymore), or replacing
specific .o dependencies with DPSRCS entries.

Tested with "make -j 8 distribution" and "make distribution".
2003-08-01 17:03:41 +00:00
lukem 5aab21f43a be consistent when adding *.y and *.l to DPSRCS 2003-07-28 23:54:24 +00:00
lukem e71812aa94 Overhaul how the .{c,cc,cpp,cxx,C,f,m.S}.{o,po,so} rules are implemented:
only list the (often complicated) ${COMPILE.*} rules once always building
to ${.TARGET}.tmp.  Then, depending on whether *OPTS has -g, either
"mv ${.TARGET}.tmp ${.TARGET}" or "${LD} -[xX] -r ${TARGET}.tmp -o ${.TARGET}"
as appropriate.
This can prevent inconsistency that could occur between "echo ${COMPILE.*:Q}"
and "${COMPILE.*}", such as the problem in rev 1.226.  (There were still
examples of this in .cc.so and .m.so !!!)

Remove `@' from most non-echo rules, so that we can actually see what's
happening.  This helps debugging problems, such as that fixed by rev 1.226.

Always remove all possible temp files that might occur because of the above.

Be consistent about ${CC} instead of $(CC)
2003-07-28 04:08:47 +00:00
lukem 719829bd45 Pull in <bsd.sys.mk> before supplying our own .c.o (et al) rules.
Otherwise, <bsd.sys.mk>'s implementations will be used instead.  (oops!)
2003-07-28 02:29:35 +00:00
lukem 7a4d405e11 fix typo (insert botch? :) in previous, which broke .cxx.po 2003-07-28 00:51:47 +00:00
mrg 96d9a01177 introduce a new $CPPFLAG_ISYSTEMXX that is used to reference c++ system
includes.  for GCC3, set this to -I instead of -isystem.

XXX this should really be either not required or a -isystem-cxx, but for
now this is required to build libstdc++-v3, which otherwise complains
heavily about STL headers not being C code(!)
2003-07-27 14:49:22 +00:00
lukem 29c0479a2a Add source-file-specific variables in <bsd.lib.mk> and <bsd.prog.mk>:
COPTS.<fn>	Additional flags to the compiler when creating the C objects
		for <fn>.

CPUFLAGS.<fn>	Additional flags to the compiler/assembler for <fn>.

CPPFLAGS.<fn>	Additional flags to the C pre-processor for <fn>.


(For <fn>.[ly], "<fn>.c" must be used.)
2003-07-22 06:53:21 +00:00
lukem b6bdfc6774 Consistently support the different C++ file extensions: .cc .cpp .cxx .C
Noted by Andrew White in PR toolchain/18246
2003-07-20 17:01:58 +00:00
lukem 87610a53a9 whitespace cleanup 2003-07-18 04:04:03 +00:00
drochner a915fb6b1e Use ${CC} instead of ${LD} to build shared objects.
(g)cc has all the knowledge which startfiles/libgcc to
use, so we don't need to duplicate all that here.

Externally visible change:
Shared objects are linked against libgcc_pic.a now
(if the in-tree gcc2 is used). This fixes problems with
dlopen()'ed objects referencing libgcc functions not used
(thus not linked in) by the main program.
2003-06-27 17:27:11 +00:00
msaitoh 535480c5be catch signal 1,2,3,13 and 15 to clean /tmp/_dependXXX 2003-06-11 04:56:58 +00:00
thorpej 000836e000 If EXTERNAL_TOOLCHAIN is defined, allow the compiler to define the
location of crt{begin,end}{,S}.o and libgcc.a.  Encapsulate all of
this logic into the new bsd.gcc.mk, and use it in bsd.prog.mk and
bsd.lib.mk.
2003-05-31 20:33:15 +00:00
wiz 43075c01c6 Use && instead of ; to only overwrite a file if the corresponding sed worked (from christos).
Add .cpp rules.
2003-05-27 19:32:18 +00:00
wiz 135b433e9c s/${ECHO}/@echo/, since we don't define ECHO in share/mk. 2003-05-26 12:38:59 +00:00
christos 2b009f6aa8 fix lossage caused by previous commit. 2003-04-22 12:55:26 +00:00
christos 6fab16d795 PR/6257: Izumi Tsutsui: bsd.lib.mk should set target only if LIB is defined. 2003-04-20 21:57:17 +00:00
thorpej 9d788d6da1 Provide the MKPICLIB value in bsd.own.mk, rather than bsd.lib.mk. It
is sometimes necessary for non-library Makefiles to determine if _pic
libraries are being built.

Problem pointed out by Havard Eidnes.
2003-04-11 22:40:31 +00:00
thorpej 44d9add676 If MACHINE_ARCH is powerpc and we HAVE_GCC3, add crtsaveres.o to the
endfile spec.
2003-03-30 00:35:07 +00:00
thorpej 6dba3a7439 Split crtbegin/crtend into crti/crtbegin/crtend/crtn. NetBSD-specific
things like the .note.netbsd.ident section are provided by crti/crtn.
crti/crtn also provide the _init() and _fini() routines.

crtbegin/crtend now only provide support for ctors/dtors.  This paves
the way to using the "crtstuff" provided with GCC (when we upgrade to
GCC 3.3), which provides, among other things, much better C++/Java
exception handling.
2002-11-22 06:44:56 +00:00
thorpej 0d842ff28e Oops, AINC actually is still used; put it back. 2002-11-10 21:26:44 +00:00
thorpej ca760b0a32 The MIPS toolchain now defines __ABICALLS__ when abicalls are in use,
and the sources now use that define, so there is no need for us to define
ABICALLS.  Since that was the only use for the AINC variable, garbage-collect
it.
2002-11-10 18:15:29 +00:00
thorpej 5d2465f251 Now that the compiler does the right thing with -KPIC, we no longer
need to add it (or -fpic, for that matter) explicitly when building
shared libraries on MIPS.
2002-11-09 08:22:04 +00:00
perry 8885724457 Pass 1 of SYSPKG changes to automatically add tags=pkgname_pkg to METALOG.
Not quite ready for prime time yet.
2002-10-22 18:48:27 +00:00
thorpej 09a0767aa9 Only use the MKDYNAMICROOT semantics (i.e. -rpath=/lib,/usr/lib and
-dynamic-linker=/libexec/ld.elf_so) if the BINDIR of the program being
built is /bin or /sbin.

The reason we do this is because now all programs *except* those in
/bin and /sbin (i.e. the "special cases") match the default the compiler
uses, which is what is used for things in e.g. xsrc, pkgsrc, and other
random 3rd party programs.

This is done by decoupling where a shlib is installed from how it
is located.  Two new variables, SHLIBINSTALLDIR and SHLINKINSTALLDIR,
contain the former information, and key off MKDYNAMICROOT only.  SHLIBDIR
and SHLINKDIR contain the latter, and key off MKDYNAMICROOT and BINDIR.

The SHLIBINSTALLDIR, SHLIBDIR, _LIBSODIR, SHLINKINSTALLDIR, and
SHLINKDIR parameters are moved to a new <bsd.shlib.mk>; see bsd.README
for usage details.
2002-09-27 21:37:50 +00:00
thorpej 4c81eb7f69 If DESTDIR is set, add ${DESTDIR}/usr/libdata to the lint library
search path.  This works around the problem of lint using the
wrong lint libraries until a "lint -d ..." equivalent is implemented
for libraries.
2002-09-14 16:56:10 +00:00
yamt 4f420b3122 - add CSHLIBFLAGS.
- fix typos in comment.
2002-07-20 08:50:10 +00:00
fredette 9c5d82c38e Added a temporary workaround when building libraries for hppa:
link in libgcc to get the millicode routines.
2002-07-01 19:29:31 +00:00
eeh 25dfe267a1 Don't add -DBIGPIC to APICFLAGS. 2002-05-07 02:06:32 +00:00
eeh 90c1726789 Turn on 32-bit relocations for sparc64 PIC code. 2002-05-07 01:45:45 +00:00
lukem 82172c42f6 Implement NETBSDSRCDIR, which is the top level of the NetBSD source tree.
Defaults to the directory determined by the _SRC_TOP_ logic (if != ""),
and the BSDSRCDIR.

NETBSDSRCDIR has been provided for use by the various NetBSD source
Makefiles to find the top of the NetBSD source tree, and isn't
affected by the inheritance properties of _SRC_TOP_, nor does it
have the magic BSDOBJDIR baggage that BSDSRCDIR is stuck with.
2002-04-26 15:02:02 +00:00
lukem 0476c683f0 replace BSDSRCDIR with _SRC_TOP_, since the latter is more likely to
be "accurate".  document _SRC_TOP_.
2002-04-10 15:05:41 +00:00
lukem 328fa6b19f use ${VAR:D:U...} if we only want a value in the undefined case 2002-03-19 22:17:23 +00:00
lukem 1995e199a3 Change library installation.
Instead of:
	install -m 600 [...]
	ranlib -t [...]
	chmod 444 [...]
use the newly added "-a" flag to install(1) to invoke ranlib ifndef UPDATE.
Should prevent unnecessary ranlib-ing of installed libraries with UPDATE
defined.

Per discussion with simonb.
2002-03-19 14:39:22 +00:00
mycroft 09819b05ef Don't use .PHONY for targets that are actually installed. Instead use force
dependencies.  (Among other things, `make -t install' does something vaguely
sensible now.)
2002-02-11 21:14:58 +00:00
lukem 56640963f5 cosmetic tweak on an older comment 2001-12-28 01:40:50 +00:00
lukem efcc9a4c9d * Add user-controlled mk.conf variables
- SHLIBDIR	Location to install shared libraries if ${USE_SHLIBDIR}
			is "yes".  Defaults to "/usr/lib".

	- USE_SHLIBDIR	If "yes", install shared libraries in ${SHLIBDIR}
			instead of ${LIBDIR}.  Defaults to "no".
			Sets ${_LIBSODIR} to the appropriate value.
			This may be set by individual Makefiles as well.

	- SHLINKDIR	Location of shared linker.  Defaults to "/usr/libexec".
			If != "/usr/libexec", change the dynamic-linker
			encoded in shared programs

* Set USE_SHLIBDIR for libraries used by /bin and /sbin:
	libc libcrypt libcrypto libedit libipsec libkvm libm libmi387
	libtermcap libutil libz

* If ${_LIBSODIR} != ${LIBDIR}, add symlinks from ${LIBDIR}/${LIB}.so*
  to ${_LIBSODIR}/${LIB}.so* for compatibility.

* Always install /sbin/init statically (for now)


The net effect of these changes depends on how the variables are set:

  1.)	If nothing is set or changed, there is no change from the
	current behaviour:
		- Static /bin, /sbin, and bits of /usr/*
		- Dynamic rest
		- Shared linker is /usr/libexec/ld*so

  2.)	If the following make variables are set:
		LDSTATIC=
		SHLINKDIR=/lib
		SHLIBDIR=/lib
	Then the behaviour becomes:
		- Dynamic tools
		- .so libraries used by /bin and /sbin are installed to /lib,
		  with symlinks from /usr/lib/lib*so to -> /lib/lib*so
		  where appropriate
		- Shared linker is /lib/ld*so

  3.)	As per 2.), but add the following variable:
		USE_SHLIBDIR=yes
	This forces all .so's to be instaleld in /lib (with compat
	symlinks), not just those tagged by their Makefiles to be.
	Again, compat symlinks are installed
2001-12-28 01:32:37 +00:00
tv 4a1ad2db60 If DESTDIR is set, do a similar nostdinc dance for the standard C++ include
directory.
2001-11-28 04:38:29 +00:00
perry 6385e197e2 Now that install has been fixed to deal with -r in the symlink case,
make bsd.lib.mk use INSTALL_SYMLINK instead of mv and ln -s.
Note: There is still one weird case I left alone, in which symlinks
get built in the objdir. I didn't want to log metadata for those links
so I left the old machinery in for them.
XXX do we even need that elaborate dance for the ln's in the objdir?
2001-11-24 21:23:38 +00:00
thorpej 8bfeb9a270 Use a little transitional hack to determine if we use -isystem
or -idirafter.  Use the former only of USE_NEW_TOOLCHAIN, since
-isystem causes the old toolchain to bomb out when building
libstdc++.
2001-11-19 02:46:50 +00:00
tv 6699960dbf C/..$/.c/ -> C/\..$/.c/ 2001-11-14 23:06:26 +00:00
tv c8c3cf578b Move the DESTDIR-based nostdinc logic to bsd.lib.mk and bsd.prog.mk where
it belongs (with the native target compile rules).
2001-11-14 21:49:53 +00:00
simonb 7d1f940ec6 Set installed library mode correctly in UNPRIVILEGED case. 2001-11-02 07:25:58 +00:00
tv 1129ed4afe Improve readability and reduce redundant redundancy in share/mk; add some
descriptive comments.  The guts of hostprog, lib, and prog are mostly
unchanged; this will be done in another pass.

Make several things work properly with UNPRIVILEGED set, and make the
install-time "cmp" logic work for MANZ.  Also reimplement INCS{DIR,NAME}_foo
(requested by wiz) in a backwards compatible way.

Reviewed by christos.
2001-11-02 05:21:47 +00:00
nathanw 41ee0930b0 Don't explicitly set SHLIB_LDSTARTFILE and SHLIB_LDENDFILE for the
generic architecture case; this permits the later ELF clause to set
them properly for ELF platforms.

This will cause crtbeginS.o and crtendS.o to be included in shared
libraries built on all ELF platforms, not just alpha, mips, vax, and
sparc.
2001-10-25 19:32:15 +00:00
tv ccfbe64e81 Add .NOPATH for all files generated from .l or .y files in SRCS. Fixes PRs
bin/14187 and lib/14239.

Also simplify the handling of these transforms to .c and .h files a bit by
leveraging make's builtin macro operators.
2001-10-19 15:55:52 +00:00
tv b868449232 Since SHLIB_MAJOR may be set even in a MKPIC=no situation, make sure that
print-shlib-* targets only print stuff if MKPIC=yes.
2001-09-21 15:25:49 +00:00
tv e949020a8e If SHLIB_MAJOR is explicitly set in a Makefile, don't even look for a
shlib_version file.  (Part of a larger change which will also update
checkver to deal with this, and migrate old makefiles to include
SHLIB_MAJOR/SHLIB_MINOR.  For now, just add the hooks so that the old
gnu/lib toolchain libraries can use this as a workaround.)
2001-09-21 15:16:09 +00:00