From owner-freebsd-questions Fri Mar 20 09:22:36 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA04669 for freebsd-questions-outgoing; Fri, 20 Mar 1998 09:22:36 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from ceddec.com (brickwall.ceddec.com [207.91.200.193]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA04586 for ; Fri, 20 Mar 1998 09:22:18 -0800 (PST) (envelope-from root@hub.freebsd.org) Received: by brickwall.ceddec.com id <43009>; Fri, 20 Mar 1998 12:16:58 -0500 Message-Id: <98Mar20.121658est.43009@brickwall.ceddec.com> Date: Fri, 20 Mar 1998 12:16:00 -0500 To: freebsd-questions@FreeBSD.ORG X-URL: http://www.freebsd.org/support.html X-Mailer: Lynx, Version 2.7.2 X-Personal_name: tom zerucha From: tz@execpc.com Subject: Makefile, sys.mk, and option (lib) ordering for gcc Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I am having severe problems getting my programs to link with FreeBSD using make when they work fine under Linux. The problem is that FreeBSD pays strict attention to the ordering, so when I need -lx -ly -lz, where libx.a needs liby.a, and liby.a needs libz.a, I must specify these in order AND AFTER ALL OBJECTS. In sys.mk, there are two rules (one posix and one non-posix) .c: ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} The problem is that for the compile to work, I have to get the libs *after* the IMPSRC, i.e. if I put the libs in the LDFLAGS it becomes cc -lx -ly -lz -o w w.c and fails. Altering sys.mk allowed everything to work, but under Linux, the above cc line works. I need a Makefile that works under both Linux and FreeBSD, and don't know how to do this without respecifying the rules in my Makefiles, unless there is something different about how gcc runs under both OSes. How can I tell FreeBSD to link in the libraries last? (please respond by reply email to tz@execpc.com) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message