File:  [DragonFly] / src / share / mk / sys.mk
Revision 1.3: download - view: text, annotated - select for diffs
Mon Jan 26 16:13:49 2004 UTC (10 years, 8 months ago) by joerg
Branches: MAIN
CVS tags: HEAD
Always include bsd.init.mk to fix CPUTYPE evaluation

    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.3 2004/01/26 16:13:49 joerg 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
   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: CFLAGS		?=	-O -pipe
   43: 
   44: CXX		?=	c++
   45: CXXFLAGS	?=	${CXXINCLUDES} ${CFLAGS}
   46: 
   47: CPP		?=	cpp
   48: 
   49: .if ${.MAKEFLAGS:M-s} == ""
   50: ECHO		?=	echo
   51: ECHODIR		?=	echo
   52: .else
   53: ECHO		?=	true
   54: .if ${.MAKEFLAGS:M-s} == "-s"
   55: ECHODIR		?=	echo
   56: .else
   57: ECHODIR		?=	true
   58: .endif
   59: .endif
   60: 
   61: .if defined(%POSIX)
   62: FC		?=	fort77
   63: FFLAGS		?=	-O 1
   64: .else
   65: FC		?=	f77
   66: FFLAGS		?=	-O
   67: .endif
   68: EFLAGS		?=
   69: 
   70: INSTALL		?=	install
   71: 
   72: LEX		?=	lex
   73: LFLAGS		?=
   74: 
   75: LD		?=	ld
   76: LDFLAGS		?=
   77: 
   78: LINT		?=	lint
   79: LINTFLAGS	?=	-chapbx
   80: 
   81: MAKE		?=	make
   82: 
   83: OBJC		?=	cc
   84: OBJCFLAGS	?=	${OBJCINCLUDES} ${CFLAGS} -Wno-import
   85: 
   86: PC		?=	pc
   87: PFLAGS		?=
   88: 
   89: RC		?=	f77
   90: RFLAGS		?=
   91: 
   92: SHELL		?=	sh
   93: 
   94: YACC		?=	yacc
   95: .if defined(%POSIX)
   96: YFLAGS		?=
   97: .else
   98: YFLAGS		?=	-d
   99: .endif
  100: 
  101: # FreeBSD/i386 has traditionally been built with a version of make
  102: # which knows MACHINE, but not MACHINE_ARCH. When building on other
  103: # architectures, assume that the version of make being used has an
  104: # explicit MACHINE_ARCH setting and treat a missing MACHINE_ARCH
  105: # as an i386 architecture.
  106: MACHINE_ARCH	?=	i386
  107: 
  108: .if defined(%POSIX)
  109: # Posix 1003.2 mandated rules
  110: #
  111: # Quoted directly from the Posix 1003.2 draft, only the macros
  112: # $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and
  113: # ${.PREFIX}, resp.
  114: 
  115: # SINGLE SUFFIX RULES
  116: .c:
  117: 	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
  118: 
  119: .f:
  120: 	${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
  121: 
  122: .sh:
  123: 	cp ${.IMPSRC} ${.TARGET}
  124: 	chmod a+x ${.TARGET}
  125: 
  126: # DOUBLE SUFFIX RULES
  127: 
  128: .c.o:
  129: 	${CC} ${CFLAGS} -c ${.IMPSRC}
  130: 
  131: .f.o:
  132: 	${FC} ${FFLAGS} -c ${.IMPSRC}
  133: 
  134: .y.o:
  135: 	${YACC} ${YFLAGS} ${.IMPSRC}
  136: 	${CC} ${CFLAGS} -c y.tab.c
  137: 	rm -f y.tab.c
  138: 	mv y.tab.o ${.TARGET}
  139: 
  140: .l.o:
  141: 	${LEX} ${LFLAGS} ${.IMPSRC}
  142: 	${CC} ${CFLAGS} -c lex.yy.c
  143: 	rm -f lex.yy.c
  144: 	mv lex.yy.o ${.TARGET}
  145: 
  146: .y.c:
  147: 	${YACC} ${YFLAGS} ${.IMPSRC}
  148: 	mv y.tab.c ${.TARGET}
  149: 
  150: .l.c:
  151: 	${LEX} ${LFLAGS} ${.IMPSRC}
  152: 	mv lex.yy.c ${.TARGET}
  153: 
  154: .c.a:
  155: 	${CC} ${CFLAGS} -c ${.IMPSRC}
  156: 	${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
  157: 	rm -f ${.PREFIX}.o
  158: 
  159: .f.a:
  160: 	${FC} ${FFLAGS} -c ${.IMPSRC}
  161: 	${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
  162: 	rm -f ${.PREFIX}.o
  163: 
  164: .else
  165: 
  166: # non-Posix rule set
  167: 
  168: .sh:
  169: 	cp -p ${.IMPSRC} ${.TARGET}
  170: 	chmod a+x ${.TARGET}
  171: 
  172: .c:
  173: 	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
  174: 
  175: .c.o:
  176: 	${CC} ${CFLAGS} -c ${.IMPSRC}
  177: 
  178: .cc .cpp .cxx .C:
  179: 	${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
  180: 
  181: .cc.o .cpp.o .cxx.o .C.o:
  182: 	${CXX} ${CXXFLAGS} -c ${.IMPSRC}
  183: 
  184: .m.o:
  185: 	${OBJC} ${OBJCFLAGS} -c ${.IMPSRC}
  186: 
  187: .p.o:
  188: 	${PC} ${PFLAGS} -c ${.IMPSRC}
  189: 
  190: .e .r .F .f:
  191: 	${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \
  192: 	    -o ${.TARGET}
  193: 
  194: .e.o .r.o .F.o .f.o:
  195: 	${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC}
  196: 
  197: .S.o:
  198: 	${CC} ${CFLAGS} -c ${.IMPSRC}
  199: 
  200: .s.o:
  201: 	${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
  202: 
  203: # XXX not -j safe
  204: .y.o:
  205: 	${YACC} ${YFLAGS} ${.IMPSRC}
  206: 	${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
  207: 	rm -f y.tab.c
  208: 
  209: .l.o:
  210: 	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
  211: 	${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET}
  212: 	rm -f ${.PREFIX}.tmp.c
  213: 
  214: # XXX not -j safe
  215: .y.c:
  216: 	${YACC} ${YFLAGS} ${.IMPSRC}
  217: 	mv y.tab.c ${.TARGET}
  218: 
  219: .l.c:
  220: 	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET}
  221: 
  222: .s.out .c.out .o.out:
  223: 	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
  224: 
  225: .f.out .F.out .r.out .e.out:
  226: 	${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \
  227: 	    ${LDLIBS} -o ${.TARGET}
  228: 	rm -f ${.PREFIX}.o
  229: 
  230: # XXX not -j safe
  231: .y.out:
  232: 	${YACC} ${YFLAGS} ${.IMPSRC}
  233: 	${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
  234: 	rm -f y.tab.c
  235: 
  236: .l.out:
  237: 	${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
  238: 	${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
  239: 	rm -f ${.PREFIX}.tmp.c
  240: 
  241: .endif
  242: 
  243: .if exists(/etc/defaults/make.conf)
  244: .include </etc/defaults/make.conf>
  245: .endif
  246: 
  247: __MAKE_CONF?=/etc/make.conf
  248: .if exists(${__MAKE_CONF})
  249: .include "${__MAKE_CONF}"
  250: .endif
  251: 
  252: .include <bsd.init.mk>
  253: .include <bsd.cpu.mk>
  254: 
  255: .if exists(/etc/make.conf.local)
  256: .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.
  257: .include </etc/make.conf.local>
  258: .endif
  259: 
  260: #
  261: # The build tools are indirected by /usr/bin/objformat which determines the
  262: # object format from the OBJFORMAT environment variable and if this is not
  263: # defined, it reads /etc/objformat.
  264: #
  265: .if exists(/etc/objformat) && !defined(OBJFORMAT)
  266: .include "/etc/objformat"
  267: .endif
  268: 
  269: # Default executable format
  270: OBJFORMAT?=	elf