Date: Fri, 20 Mar 1998 12:16:00 -0500 From: tz@execpc.com To: freebsd-questions@FreeBSD.ORG Subject: Makefile, sys.mk, and option (lib) ordering for gcc Message-ID: <98Mar20.121658est.43009@brickwall.ceddec.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?98Mar20.121658est.43009>