From bd42830f0f184a31924e8df802724d1974ddb278 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Wed, 20 Mar 2002 18:25:50 +0000 Subject: [PATCH] Make lint(1) a cross-tool. (See commit log for usr.bin/xlint/Makefile,v 1.11 for what was wrong with enabling build of lint libraries in rev. 1.12.) This fixes cross-arch compiles (running binaries for a different arch when generating lint.7 and lint libraries) and cross-branch compiles (4.x -> 5.0 buildworld should be working again). --- Makefile.inc1 | 4 +++- share/mk/sys.mk | 2 +- usr.bin/xlint/Makefile | 2 -- usr.bin/xlint/Makefile.inc | 3 ++- usr.bin/xlint/lint1/Makefile | 12 +++++++----- usr.bin/xlint/llib/Makefile | 7 ------- usr.bin/xlint/xlint/Makefile | 1 + usr.bin/xlint/xlint/pathnames.h | 9 +++------ 8 files changed, 17 insertions(+), 23 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index b05eddb6a3e..6ba1b12ce4d 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -615,9 +615,11 @@ _elf2exe= usr.sbin/elf2exe _btxld= usr.sbin/btxld .endif +_xlint= usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint + cross-tools: .for _tool in ${_btxld} ${_elf2exe} \ - gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc + gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc ${_xlint} cd ${.CURDIR}/${_tool}; \ ${MAKE} obj; \ ${MAKE} depend; \ diff --git a/share/mk/sys.mk b/share/mk/sys.mk index d804c90b76c..89ef00c8669 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -76,7 +76,7 @@ LD ?= ld LDFLAGS ?= LINT ?= lint -LINTFLAGS ?= -cghapbx -L /usr/libdata/lint +LINTFLAGS ?= -cghapbx LINTKERNFLAGS ?= ${LINTFLAGS} LINTOBJFLAGS ?= -cghapbxu -i LINTLIBFLAGS ?= -cghapbxu -C ${LIB} diff --git a/usr.bin/xlint/Makefile b/usr.bin/xlint/Makefile index 3f935c68ae8..eb8c2e46e5c 100644 --- a/usr.bin/xlint/Makefile +++ b/usr.bin/xlint/Makefile @@ -3,6 +3,4 @@ SUBDIR= lint1 lint2 xlint llib -build-tools: lint1 lint2 xlint - .include diff --git a/usr.bin/xlint/Makefile.inc b/usr.bin/xlint/Makefile.inc index 91c252ba43f..82d0b34eae3 100644 --- a/usr.bin/xlint/Makefile.inc +++ b/usr.bin/xlint/Makefile.inc @@ -6,7 +6,8 @@ WARNS= 0 .PATH: ${.CURDIR}/../common -CFLAGS+= -I${.CURDIR}/../arch/${MACHINE_ARCH} +TARGET_ARCH?= ${MACHINE_ARCH} +CFLAGS+= -I${.CURDIR}/../arch/${TARGET_ARCH} CFLAGS+= -I${.CURDIR}/../common OBJECT_FMT= ELF diff --git a/usr.bin/xlint/lint1/Makefile b/usr.bin/xlint/lint1/Makefile index c6d39b92363..6371c941301 100644 --- a/usr.bin/xlint/lint1/Makefile +++ b/usr.bin/xlint/lint1/Makefile @@ -5,6 +5,7 @@ PROG= lint1 SRCS= cgram.y scan.l mem1.c mem.c err.c main1.c decl.c tree.c func.c \ init.c emit.c emit1.c inittyp.c MAN= lint.7 +CLEANFILES= lint.7 LDADD+= -ll -lm DPADD+= ${LIBL} ${LIBM} @@ -12,10 +13,11 @@ CFLAGS+= -I. -I${.CURDIR} LINTFLAGS=-aehpz BINDIR= /usr/libexec +OBJFORMAT_PATH?= ${BINDIR} # src/Makefile.inc1 sets this + +.PATH: ${.CURDIR}/../common + +lint.7: makeman + sh ${.CURDIR}/makeman ${OBJFORMAT_PATH}/${PROG} -m >${.TARGET} .include - -.PATH: ../common - -lint.7: makeman - sh ${.CURDIR}/makeman ${.OBJDIR}/${PROG} -m >${.TARGET} diff --git a/usr.bin/xlint/llib/Makefile b/usr.bin/xlint/llib/Makefile index 3fd0ff139e8..9f1e3c1568e 100644 --- a/usr.bin/xlint/llib/Makefile +++ b/usr.bin/xlint/llib/Makefile @@ -1,18 +1,11 @@ # $NetBSD: Makefile,v 1.7 2000/06/14 20:22:19 matt Exp $ # $FreeBSD$ -.include - LIBS= llib-lposix.ln llib-lstdc.ln -LINT= ${.OBJDIR}/../xlint/xlint FILES= ${LIBS} FILESDIR= ${LINTLIBDIR} -install: - ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${LIBMODE} \ - ${LIBS} ${DESTDIR}${LINTLIBDIR} - CLEANFILES+= ${LIBS} llib-lposix.ln: llib-lposix diff --git a/usr.bin/xlint/xlint/Makefile b/usr.bin/xlint/xlint/Makefile index 9ac2f93d436..5dfdfb314a7 100644 --- a/usr.bin/xlint/xlint/Makefile +++ b/usr.bin/xlint/xlint/Makefile @@ -9,6 +9,7 @@ SRCS= xlint.c mem.c MAN= lint.1 CFLAGS+=-I${.CURDIR}/../lint1 +CFLAGS+= -DPREFIX=\"${TOOLS_PREFIX}\" .include "${.CURDIR}/../../Makefile.inc" .include diff --git a/usr.bin/xlint/xlint/pathnames.h b/usr.bin/xlint/xlint/pathnames.h index 112081ce57b..3f7d210530d 100644 --- a/usr.bin/xlint/xlint/pathnames.h +++ b/usr.bin/xlint/xlint/pathnames.h @@ -35,14 +35,11 @@ /* directory where lint1 and lint2 reside */ #ifndef PATH_LIBEXEC -#define PATH_LIBEXEC "/usr/libexec" +#define PATH_LIBEXEC PREFIX"/usr/libexec" #endif /* directory where cc(1) resides */ -#define PATH_USRBIN "/usr/bin" - -/* directory where cc(1) resides */ -#define PATH_USRBIN "/usr/bin" +#define PATH_USRBIN PREFIX"/usr/bin" /* default library search path */ -#define PATH_LINTLIB "/usr/libdata/lint" +#define PATH_LINTLIB PREFIX"/usr/libdata/lint"