File:  [DragonFly] / src / share / mk / sys.mk
Revision 1.7: download - view: text, annotated - select for diffs
Fri Mar 26 21:57:23 2004 UTC (10 years, 5 months ago) by dillon
Branches: MAIN
CVS tags: HEAD
The NXCC (native C compiler) misnamed OBJFORMATPATH, it neesd to be
OBJFORMAT_PATH, causing 'missing crt1.o' from ld in the buildworld
includes stage.

    1: #	from: @(#)sys.mk	8.2 (Berkeley) 3/21/94
    2: # $FreeBSD: src/share/mk/sys.mk,v 1.45.2.6 2002/12/23 16:33:37 ru Exp $
    3: # $DragonFly: src/share/mk/sys.mk,v 1.7 2004/03/26 21:57:23 dillon Exp $
    4: 
    5: unix		?=	We run FreeBSD, not UNIX.
    6: 
    7: # If the special target .POSIX appears (without prerequisites or
    8: # commands) before the first noncomment line in the makefile, make shall
    9: # process the makefile as specified by the Posix 1003.2 specification.
   10: # make(1) sets the special macro %POSIX in this case (to the actual
   11: # value "1003.2", for what it's worth).
   12: #
   13: # The rules below use this macro to distinguish between Posix-compliant
   14: # and default behaviour.
   15: 
   16: .if defined(%POSIX)
   17: .SUFFIXES:	.o .c .y .l .a .sh .f
   18: .else
   19: .SUFFIXES:	.out .a .ln .o .c .cc .cpp .cxx .C .m .F .f .e .r .y .l .S .s .cl .p .h .sh .no .nx
   20: .endif
   21: 
   22: .LIBS:		.a
   23: 
   24: X11BASE		?=	/usr/X11R6
   25: 
   26: AR		?=	ar
   27: .if defined(%POSIX)
   28: ARFLAGS		?=	-rv
   29: .else
   30: ARFLAGS		?=	rl
   31: .endif
   32: RANLIB		?=	ranlib
   33: 
   34: AS		?=	as
   35: AFLAGS		?=
   36: 
   37: .if defined(%POSIX)
   38: CC		?=	c89
   39: .else
   40: CC		?=	cc
   41: .endif
   42: # The system cc frontend is not subject to the path, e.g. when buildworld
   43: # is doing cross compiles it may still need the native compiler for things.
   44: #
   45: NXCC		?=	OBJFORMAT_PATH=/ ${CC}
   46: CFLAGS		?=	-O -pipe
   47: 
   48: CXX		?=	c++
   49: CXXFLAGS	?=	${CXXINCLUDES} ${CFLAGS}
   50: 
   51: CPP		?=	cpp
   52: 
   53: .if ${.MAKEFLAGS:M-s} == ""
   54: ECHO		?=	echo
   55: ECHODIR		?=	echo
   56: .else
   57: ECHO		?=	true
   58: .if ${.MAKEFLAGS:M-s} == "-s"
   59: ECHODIR		?=	echo
   60: .else
   61: ECHODIR		?=	true
   62: .endif
   63: .endif
   64: 
   65: .if defined(%POSIX)
   66: FC		?=	fort77
   67: FFLAGS		?=	-O 1
   68: .else
   69: FC		?=	f77
   70: FFLAGS		?=	-O
   71: .endif
   72: EFLAGS		?=
   73: 
   74: INSTALL		?=	install
   75: 
   76: LEX		?=	lex
   77: LFLAGS		?=
   78: 
   79: LD		?=	ld
   80: LDFLAGS		?=
   81: NXCFLAGS	?=	${CFLAGS}
   82: NXLDLIBS	?=	${LDLIBS}
   83: NXLDFLAGS	?=	-static ${LDFLAGS}
   84: 
   85: LINT		?=	lint
   86: LINTFLAGS	?=	-chapbx
   87: 
   88: MAKE		?=	make
   89: 
   90: OBJC		?=	cc
   91: OBJCFLAGS	?=	${OBJCINCLUDES} ${CFLAGS} -Wno-import
   92: 
   93: PC		?=	pc
   94: PFLAGS		?=
   95: 
   96: RC		?=	f77
   97: RFLAGS		?=
   98: 
   99: SHELL		?=	sh
  100: 
  101: YACC		?=	yacc
  102: .if defined(%POSIX)
  103: YFLAGS		?=
  104: .else
  105: YFLAGS		?=	-d
  106: .endif
  107: 
  108: # FreeBSD/i386 has traditionally been built with a version of make
  109: # which knows MACHINE, but not MACHINE_ARCH. When building on other
  110: # architectures, assume that the version of make being used has an
  111: # explicit MACHINE_ARCH setting and treat a missing MACHINE_ARCH
  112: # as an i386 architecture.
  113: MACHINE_ARCH	?=	i386
  114: 
  115: .if defined(%POSIX)
  116: # Posix 1003.2 mandated rules
  117: #
  118: # Quoted directly from the Posix 1003.2 draft, only the macros
  119: # $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and
  120: # ${.PREFIX}, resp.
  121: 
  122: # SINGLE SUFFIX RULES
  123: .c:
  124: 	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
  125: 
  126: .f:
  127: 	${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
  128: 
  129: .sh:
  130: 	cp ${.IMPSRC} ${.TARGET}
  131: 	chmod a+x ${.TARGET}
  132: 
  133: # DOUBLE SUFFIX RULES
  134: 
  135: .c.o:
  136: 	${CC} ${CFLAGS} -c ${.IMPSRC}
  137: 
  138: .f.o:
  139: 	${FC} ${FFLAGS} -c ${.IMPSRC}
  140: 
  141: .y.o:
  142: 	${YACC} ${YFLAGS} ${.IMPSRC}
  143: 	${CC} ${CFLAGS} -c y.tab.c
  144: 	rm -f y.tab.c
  145: 	mv y.tab.o ${.TARGET}
  146: 
  147: .l.o:
  148: 	${LEX} ${LFLAGS} ${.IMPSRC}
  149: 	${CC} ${CFLAGS} -c lex.yy.c
  150: 	rm -f lex.yy.c
  151: 	mv lex.yy.o ${.TARGET}
  152: 
  153: .y.c:
  154: 	${YACC} ${YFLAGS} ${.IMPSRC}
  155: 	mv y.tab.c ${.TARGET}
  156: 
  157: .l.c:
  158: 	${LEX} ${LFLAGS} ${.IMPSRC}
  159: 	mv lex.yy.c ${.TARGET}
  160: 
  161: .c.a:
  162: 	${CC} ${CFLAGS} -c ${.IMPSRC}
  163: 	${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
  164: 	rm -f ${.PREFIX}.o
  165: 
  166: .f.a:
  167: 	${FC} ${FFLAGS} -c ${.IMPSRC}
  168: 	${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
  169: 	rm -f ${.PREFIX}.o
  170: 
  171: .else
  172: 
  173: # non-Posix rule set
  174: 
  175: .sh:
  176: 	cp -p ${.IMPSRC} ${.TARGET}
  177: 	chmod a+x ${.TARGET}
  178: 
  179: .c:
  180: 	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
  181: 
  182: .c.o:
  183: 	${CC} ${CFLAGS} -c ${.IMPSRC}
  184: 
  185: .cc .cpp .cxx .C:
  186: 	${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
  187: 
  188: .cc.o .cpp.o .cxx.o .C.o:
  189: 	${CXX} ${CXXFLAGS} -c ${.IMPSRC}
  190: 
  191: .m.o:
  192: 	${OBJC} ${OBJCFLAGS} -c ${.IMPSRC}
  193: 
  194: .p.o:
  195: 	${PC} ${PFLAGS} -c ${.IMPSRC}
  196: 
  197: .e .r .F .f:
  198: 	${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \
  199: 	    -o ${.TARGET}
  200: 
  201: .e.o .r.o .F.o .f.o:
  202: 	${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC}
  203: 
  204: .S.o:
  205: 	${CC} ${CFLAGS} -c ${.IMPSRC}
  206: 
  207: .s.o:
  208: 	${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
  209: 
  210: # XXX not -j safe
  211: .y.o:
  212: 	${YACC} ${YFLAGS} ${.IMPSRC}
  213: 	${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
  214: 	rm -f y.tab.c
  215: 
  216: .l.o:
  217: 	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
  218: 	${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET}
  219: 	rm -f ${.PREFIX}.tmp.c
  220: 
  221: # .no == native object file, for helper code when cross building.
  222: #
  223: .c.no:
  224: 	${NXCC} ${NXCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
  225: 
  226: .y.no:
  227: 	${YACC} ${YFLAGS} ${.IMPSRC}
  228: 	${NXCC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
  229: 	rm -f y.tab.c
  230: 
  231: .l.no:
  232: 	${LEX} ${LFLAGS} -o${.TARGET}.c ${.IMPSRC}
  233: 	${NXCC} ${CFLAGS} -c ${.TARGET}.c -o ${.TARGET}
  234: 	rm -f ${.TARGET}.c
  235: 
  236: .no.nx .c.nx:
  237: 	${NXCC} ${NXCFLAGS} ${NXLDFLAGS} ${.IMPSRC} ${NXLDLIBS} -o ${.TARGET}
  238: 
  239: # XXX not -j safe
  240: .y.c:
  241: 	${YACC} ${YFLAGS} ${.IMPSRC}
  242: 	mv y.tab.c ${.TARGET}
  243: 
  244: .l.c:
  245: 	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET}
  246: 
  247: .s.out .c.out .o.out:
  248: 	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
  249: 
  250: .f.out .F.out .r.out .e.out:
  251: 	${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \
  252: 	    ${LDLIBS} -o ${.TARGET}
  253: 	rm -f ${.PREFIX}.o
  254: 
  255: # XXX not -j safe
  256: .y.out:
  257: 	${YACC} ${YFLAGS} ${.IMPSRC}
  258: 	${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
  259: 	rm -f y.tab.c
  260: 
  261: .l.out:
  262: 	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
  263: 	${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
  264: 	rm -f ${.PREFIX}.tmp.c
  265: 
  266: .endif
  267: 
  268: .if exists(/etc/defaults/make.conf)
  269: .include </etc/defaults/make.conf>
  270: .endif
  271: 
  272: __MAKE_CONF?=/etc/make.conf
  273: .if exists(${__MAKE_CONF})
  274: .include "${__MAKE_CONF}"
  275: .endif
  276: 
  277: .include <bsd.cpu.mk>
  278: 
  279: .if exists(/etc/make.conf.local)
  280: .error Error, original /etc/make.conf should be moved to the /etc/defaults/ directory and /etc/make.conf.local should be renamed to /etc/make.conf.
  281: .include </etc/make.conf.local>
  282: .endif
  283: 
  284: # Default executable format
  285: # XXX hint for bsd.port.mk
  286: OBJFORMAT?=	elf
  287: