# $NetBSD: sys.mk,v 1.66.2.1 2002/06/05 03:31:01 lukem Exp $ # @(#)sys.mk 8.2 (Berkeley) 3/21/94 OS ?= NetBSD unix ?= We run ${OS}. .if !defined(MAKE_VERSION) # we are running native make # which defined MAKE_VERSION between 20010609 and 20090324 # so we can make a rough guess .if defined(.MAKE.LEVEL) MAKE_VERSION ?= 20090908 .elif defined(.MAKE.MAKEFILES) # introduced 20071008 MAKE_VERSION ?= 20090324 .else # this just before when MAKE_VERSION was introduced MAKE_VERSION ?= 20010606 .endif .endif .SUFFIXES: .out .a .ln .o .s .S .c ${CXX_SUFFIXES} .F .f .r .y .l .cl .p .h .SUFFIXES: .sh .m4 .LIBS: .a AR ?= ar ARFLAGS ?= r RANLIB ?= ranlib AS ?= as AFLAGS ?= COMPILE.s ?= ${CC} ${AFLAGS} -c LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS} COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS} CC ?= cc # need to make sure this is set MACHINE_ARCH.${MACHINE} ?= ${MACHINE} .if empty(MACHINE_ARCH) MACHINE_ARCH ?= ${MACHINE_ARCH.${MACHINE}} .endif # # CPU model, derived from MACHINE_ARCH # MACHINE_CPU ?= ${MACHINE_ARCH:C/mipse[bl]/mips/:C/mips64e[bl]/mips/:C/sh3e[bl]/sh3/:S/m68000/m68k/:S/armeb/arm/} .if ${MACHINE_CPU} == "alpha" || \ ${MACHINE_CPU} == "arm" || \ ${MACHINE_CPU} == "i386" || \ ${MACHINE_CPU} == "m68k" || \ ${MACHINE_CPU} == "mips" || \ ${MACHINE_CPU} == "powerpc" || \ ${MACHINE_CPU} == "sparc" || \ ${MACHINE_CPU} == "vax" DBG ?= -O2 .elif ${MACHINE_ARCH} == "x86_64" DBG ?= .elif ${MACHINE_ARCH} == "sparc64" DBG ?= -O -ffixed-g4 #Hack for embedany memory model compatibility .else DBG ?= -O .endif CFLAGS ?= ${DBG} COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} CXX ?= c++ CXXFLAGS ?= ${CFLAGS} COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} OBJC ?= ${CC} OBJCFLAGS ?= ${CFLAGS} COMPILE.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c LINK.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS} CPP ?= cpp CPPFLAGS ?= FC ?= f77 FFLAGS ?= -O RFLAGS ?= COMPILE.f ?= ${FC} ${FFLAGS} -c LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS} COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS} COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS} INSTALL ?= install LEX ?= lex LFLAGS ?= LEX.l ?= ${LEX} ${LFLAGS} LD ?= ld LDFLAGS ?= LINT ?= lint LINTFLAGS ?= -chapbxzF LORDER ?= lorder NM ?= nm PC ?= pc PFLAGS ?= COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS} SIZE ?= size TSORT ?= tsort -q YACC ?= yacc YFLAGS ?= YACC.y ?= ${YACC} ${YFLAGS} # C .c: ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} .c.o: ${COMPILE.c} ${.IMPSRC} .c.a: ${COMPILE.c} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o .c.ln: ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC} # C++ ${CXX_SUFFIXES}: ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} ${CXX_SUFFIXES:%=%.o}: ${COMPILE.cc} ${.IMPSRC} ${CXX_SUFFIXES:%=%.a}: ${COMPILE.cc} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o # Fortran/Ratfor .f: ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} .f.o: ${COMPILE.f} ${.IMPSRC} .f.a: ${COMPILE.f} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o .F: ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} .F.o: ${COMPILE.F} ${.IMPSRC} .F.a: ${COMPILE.F} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o .r: ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} .r.o: ${COMPILE.r} ${.IMPSRC} .r.a: ${COMPILE.r} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o # Pascal .p: ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} .p.o: ${COMPILE.p} ${.IMPSRC} .p.a: ${COMPILE.p} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o # Assembly .s: ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} .s.o: ${COMPILE.s} ${.IMPSRC} .s.a: ${COMPILE.s} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o .S: ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} .S.o: ${COMPILE.S} ${.IMPSRC} .S.a: ${COMPILE.S} ${.IMPSRC} ${AR} ${ARFLAGS} $@ $*.o rm -f $*.o # Lex .l: ${LEX.l} ${.IMPSRC} ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll rm -f lex.yy.c .l.c: ${LEX.l} ${.IMPSRC} mv lex.yy.c ${.TARGET} .l.o: ${LEX.l} ${.IMPSRC} ${COMPILE.c} -o ${.TARGET} lex.yy.c rm -f lex.yy.c # Yacc .y: ${YACC.y} ${.IMPSRC} ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} rm -f y.tab.c .y.c: ${YACC.y} ${.IMPSRC} mv y.tab.c ${.TARGET} .y.o: ${YACC.y} ${.IMPSRC} ${COMPILE.c} -o ${.TARGET} y.tab.c rm -f y.tab.c # Shell .sh: rm -f ${.TARGET} cp ${.IMPSRC} ${.TARGET} chmod a+x ${.TARGET}