1*c59c3bf3SSimon J. Gerraty# SPDX-License-Identifier: BSD-2-Clause 2*c59c3bf3SSimon J. Gerraty# 3*c59c3bf3SSimon J. Gerraty# $Id: suffixes.mk,v 1.3 2024/02/17 17:26:57 sjg Exp $ 4*c59c3bf3SSimon J. Gerraty# 5*c59c3bf3SSimon J. Gerraty# @(#) Copyright (c) 2024, Simon J. Gerraty 6*c59c3bf3SSimon J. Gerraty# 7*c59c3bf3SSimon J. Gerraty# This file is provided in the hope that it will 8*c59c3bf3SSimon J. Gerraty# be of use. There is absolutely NO WARRANTY. 9*c59c3bf3SSimon J. Gerraty# Permission to copy, redistribute or otherwise 10*c59c3bf3SSimon J. Gerraty# use this file is hereby granted provided that 11*c59c3bf3SSimon J. Gerraty# the above copyright notice and this notice are 12*c59c3bf3SSimon J. Gerraty# left intact. 13*c59c3bf3SSimon J. Gerraty# 14*c59c3bf3SSimon J. Gerraty# Please send copies of changes and bug-fixes to: 15*c59c3bf3SSimon J. Gerraty# sjg@crufty.net 16*c59c3bf3SSimon J. Gerraty# 17*c59c3bf3SSimon J. Gerraty 18*c59c3bf3SSimon J. Gerraty# some reasonable defaults 19*c59c3bf3SSimon J. Gerraty.SUFFIXES: .out .a .ln .o ${PICO} ${PCM} .s .S .c ${CXX_SUFFIXES} \ 20*c59c3bf3SSimon J. Gerraty ${CCM_SUFFIXES} .F .f .r .y .l .cl .p .h \ 21*c59c3bf3SSimon J. Gerraty .sh .m4 .cpp-out 22*c59c3bf3SSimon J. Gerraty 23*c59c3bf3SSimon J. Gerraty# 24*c59c3bf3SSimon J. GerratyAFLAGS ?= 25*c59c3bf3SSimon J. GerratyARFLAGS ?= r 26*c59c3bf3SSimon J. Gerraty.if ${MACHINE_ARCH} == "sparc64" 27*c59c3bf3SSimon J. GerratyAFLAGS+= -Wa,-Av9a 28*c59c3bf3SSimon J. Gerraty.endif 29*c59c3bf3SSimon J. GerratyAS ?= as 30*c59c3bf3SSimon J. GerratyCC ?= cc 31*c59c3bf3SSimon J. GerratyCFLAGS ?= ${DBG} 32*c59c3bf3SSimon J. GerratyCXX ?= c++ 33*c59c3bf3SSimon J. GerratyCXXFLAGS ?= ${CFLAGS} 34*c59c3bf3SSimon J. GerratyCXXFLAGS ?= ${CFLAGS} 35*c59c3bf3SSimon J. GerratyDBG ?= -O2 36*c59c3bf3SSimon J. GerratyFC ?= f77 37*c59c3bf3SSimon J. GerratyFFLAGS ?= -O 38*c59c3bf3SSimon J. GerratyINSTALL ?= install 39*c59c3bf3SSimon J. GerratyLD ?= ld 40*c59c3bf3SSimon J. GerratyLEX ?= lex 41*c59c3bf3SSimon J. GerratyLFLAGS ?= 42*c59c3bf3SSimon J. GerratyNM ?= nm 43*c59c3bf3SSimon J. GerratyOBJC ?= ${CC} 44*c59c3bf3SSimon J. GerratyOBJCFLAGS ?= ${CFLAGS} 45*c59c3bf3SSimon J. GerratyPC ?= pc 46*c59c3bf3SSimon J. GerratyPFLAGS ?= 47*c59c3bf3SSimon J. GerratyRFLAGS ?= 48*c59c3bf3SSimon J. GerratySIZE ?= size 49*c59c3bf3SSimon J. GerratyYACC ?= yacc 50*c59c3bf3SSimon J. GerratyYFLAGS ?= 51*c59c3bf3SSimon J. Gerraty 52*c59c3bf3SSimon J. GerratyCOMPILE.s ?= ${CC} ${AFLAGS} -c 53*c59c3bf3SSimon J. GerratyLINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS} 54*c59c3bf3SSimon J. GerratyCOMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp 55*c59c3bf3SSimon J. GerratyLINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS} 56*c59c3bf3SSimon J. GerratyCOMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c 57*c59c3bf3SSimon J. GerratyLINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} 58*c59c3bf3SSimon J. GerratyCOMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c 59*c59c3bf3SSimon J. GerratyCOMPILE.pcm ?= ${COMPILE.cc:N-c} --precompile -c 60*c59c3bf3SSimon J. GerratyLINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} 61*c59c3bf3SSimon J. GerratyCOMPILE.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c 62*c59c3bf3SSimon J. GerratyLINK.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS} 63*c59c3bf3SSimon J. GerratyCOMPILE.f ?= ${FC} ${FFLAGS} -c 64*c59c3bf3SSimon J. GerratyLINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS} 65*c59c3bf3SSimon J. GerratyCOMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c 66*c59c3bf3SSimon J. GerratyLINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS} 67*c59c3bf3SSimon J. GerratyCOMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c 68*c59c3bf3SSimon J. GerratyLINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS} 69*c59c3bf3SSimon J. GerratyLEX.l ?= ${LEX} ${LFLAGS} 70*c59c3bf3SSimon J. GerratyCOMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c 71*c59c3bf3SSimon J. GerratyLINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS} 72*c59c3bf3SSimon J. GerratyYACC.y ?= ${YACC} ${YFLAGS} 73*c59c3bf3SSimon J. GerratyLEX.l ?= ${LEX} ${LFLAGS} 74*c59c3bf3SSimon J. Gerraty 75*c59c3bf3SSimon J. Gerraty# C 76*c59c3bf3SSimon J. Gerraty.c: 77*c59c3bf3SSimon J. Gerraty ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 78*c59c3bf3SSimon J. Gerraty.c.o: 79*c59c3bf3SSimon J. Gerraty ${COMPILE.c} ${.IMPSRC} 80*c59c3bf3SSimon J. Gerraty.c.a: 81*c59c3bf3SSimon J. Gerraty ${COMPILE.c} ${.IMPSRC} 82*c59c3bf3SSimon J. Gerraty ${AR} ${ARFLAGS} $@ $*.o 83*c59c3bf3SSimon J. Gerraty rm -f $*.o 84*c59c3bf3SSimon J. Gerraty.c.ln: 85*c59c3bf3SSimon J. Gerraty ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC} 86*c59c3bf3SSimon J. Gerraty 87*c59c3bf3SSimon J. Gerraty# C++ 88*c59c3bf3SSimon J. Gerraty${CXX_SUFFIXES}: 89*c59c3bf3SSimon J. Gerraty ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 90*c59c3bf3SSimon J. Gerraty${CXX_SUFFIXES:%=%.o}: 91*c59c3bf3SSimon J. Gerraty ${COMPILE.cc} ${.IMPSRC} 92*c59c3bf3SSimon J. Gerraty${CXX_SUFFIXES:%=%.a}: 93*c59c3bf3SSimon J. Gerraty ${COMPILE.cc} ${.IMPSRC} 94*c59c3bf3SSimon J. Gerraty ${AR} ${ARFLAGS} $@ $*.o 95*c59c3bf3SSimon J. Gerraty rm -f $*.o 96*c59c3bf3SSimon J. Gerraty 97*c59c3bf3SSimon J. Gerraty# C++ precompiled modules 98*c59c3bf3SSimon J. Gerraty${CCM_SUFFIXES:%=%${PCM}}: 99*c59c3bf3SSimon J. Gerraty @${COMPILE.pcm} ${.IMPSRC} 100*c59c3bf3SSimon J. Gerraty 101*c59c3bf3SSimon J. Gerraty# Fortran/Ratfor 102*c59c3bf3SSimon J. Gerraty.f: 103*c59c3bf3SSimon J. Gerraty ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 104*c59c3bf3SSimon J. Gerraty.f.o: 105*c59c3bf3SSimon J. Gerraty ${COMPILE.f} ${.IMPSRC} 106*c59c3bf3SSimon J. Gerraty.f.a: 107*c59c3bf3SSimon J. Gerraty ${COMPILE.f} ${.IMPSRC} 108*c59c3bf3SSimon J. Gerraty ${AR} ${ARFLAGS} $@ $*.o 109*c59c3bf3SSimon J. Gerraty rm -f $*.o 110*c59c3bf3SSimon J. Gerraty 111*c59c3bf3SSimon J. Gerraty.F: 112*c59c3bf3SSimon J. Gerraty ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 113*c59c3bf3SSimon J. Gerraty.F.o: 114*c59c3bf3SSimon J. Gerraty ${COMPILE.F} ${.IMPSRC} 115*c59c3bf3SSimon J. Gerraty.F.a: 116*c59c3bf3SSimon J. Gerraty ${COMPILE.F} ${.IMPSRC} 117*c59c3bf3SSimon J. Gerraty ${AR} ${ARFLAGS} $@ $*.o 118*c59c3bf3SSimon J. Gerraty rm -f $*.o 119*c59c3bf3SSimon J. Gerraty 120*c59c3bf3SSimon J. Gerraty.r: 121*c59c3bf3SSimon J. Gerraty ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 122*c59c3bf3SSimon J. Gerraty.r.o: 123*c59c3bf3SSimon J. Gerraty ${COMPILE.r} ${.IMPSRC} 124*c59c3bf3SSimon J. Gerraty.r.a: 125*c59c3bf3SSimon J. Gerraty ${COMPILE.r} ${.IMPSRC} 126*c59c3bf3SSimon J. Gerraty ${AR} ${ARFLAGS} $@ $*.o 127*c59c3bf3SSimon J. Gerraty rm -f $*.o 128*c59c3bf3SSimon J. Gerraty 129*c59c3bf3SSimon J. Gerraty# Pascal 130*c59c3bf3SSimon J. Gerraty.p: 131*c59c3bf3SSimon J. Gerraty ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 132*c59c3bf3SSimon J. Gerraty.p.o: 133*c59c3bf3SSimon J. Gerraty ${COMPILE.p} ${.IMPSRC} 134*c59c3bf3SSimon J. Gerraty.p.a: 135*c59c3bf3SSimon J. Gerraty ${COMPILE.p} ${.IMPSRC} 136*c59c3bf3SSimon J. Gerraty ${AR} ${ARFLAGS} $@ $*.o 137*c59c3bf3SSimon J. Gerraty rm -f $*.o 138*c59c3bf3SSimon J. Gerraty 139*c59c3bf3SSimon J. Gerraty# Assembly 140*c59c3bf3SSimon J. Gerraty.s: 141*c59c3bf3SSimon J. Gerraty ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 142*c59c3bf3SSimon J. Gerraty.s.o: 143*c59c3bf3SSimon J. Gerraty ${COMPILE.s} ${.IMPSRC} 144*c59c3bf3SSimon J. Gerraty.s.a: 145*c59c3bf3SSimon J. Gerraty ${COMPILE.s} ${.IMPSRC} 146*c59c3bf3SSimon J. Gerraty ${AR} ${ARFLAGS} $@ $*.o 147*c59c3bf3SSimon J. Gerraty rm -f $*.o 148*c59c3bf3SSimon J. Gerraty.S: 149*c59c3bf3SSimon J. Gerraty ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 150*c59c3bf3SSimon J. Gerraty.S.o: 151*c59c3bf3SSimon J. Gerraty ${COMPILE.S} ${.IMPSRC} 152*c59c3bf3SSimon J. Gerraty.S.a: 153*c59c3bf3SSimon J. Gerraty ${COMPILE.S} ${.IMPSRC} 154*c59c3bf3SSimon J. Gerraty ${AR} ${ARFLAGS} $@ $*.o 155*c59c3bf3SSimon J. Gerraty rm -f $*.o 156*c59c3bf3SSimon J. Gerraty 157*c59c3bf3SSimon J. Gerraty# Lex 158*c59c3bf3SSimon J. Gerraty.l: 159*c59c3bf3SSimon J. Gerraty ${LEX.l} ${.IMPSRC} 160*c59c3bf3SSimon J. Gerraty ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll 161*c59c3bf3SSimon J. Gerraty rm -f lex.yy.c 162*c59c3bf3SSimon J. Gerraty.l.c: 163*c59c3bf3SSimon J. Gerraty ${LEX.l} ${.IMPSRC} 164*c59c3bf3SSimon J. Gerraty mv lex.yy.c ${.TARGET} 165*c59c3bf3SSimon J. Gerraty.l.o: 166*c59c3bf3SSimon J. Gerraty ${LEX.l} ${.IMPSRC} 167*c59c3bf3SSimon J. Gerraty ${COMPILE.c} -o ${.TARGET} lex.yy.c 168*c59c3bf3SSimon J. Gerraty rm -f lex.yy.c 169*c59c3bf3SSimon J. Gerraty 170*c59c3bf3SSimon J. Gerraty# Yacc 171*c59c3bf3SSimon J. Gerraty.y: 172*c59c3bf3SSimon J. Gerraty ${YACC.y} ${.IMPSRC} 173*c59c3bf3SSimon J. Gerraty ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} 174*c59c3bf3SSimon J. Gerraty rm -f y.tab.c 175*c59c3bf3SSimon J. Gerraty.y.c: 176*c59c3bf3SSimon J. Gerraty ${YACC.y} ${.IMPSRC} 177*c59c3bf3SSimon J. Gerraty mv y.tab.c ${.TARGET} 178*c59c3bf3SSimon J. Gerraty.y.o: 179*c59c3bf3SSimon J. Gerraty ${YACC.y} ${.IMPSRC} 180*c59c3bf3SSimon J. Gerraty ${COMPILE.c} -o ${.TARGET} y.tab.c 181*c59c3bf3SSimon J. Gerraty rm -f y.tab.c 182*c59c3bf3SSimon J. Gerraty 183*c59c3bf3SSimon J. Gerraty# Shell 184*c59c3bf3SSimon J. Gerraty.sh: 185*c59c3bf3SSimon J. Gerraty rm -f ${.TARGET} 186*c59c3bf3SSimon J. Gerraty cp ${.IMPSRC} ${.TARGET} 187*c59c3bf3SSimon J. Gerraty chmod a+x ${.TARGET} 188*c59c3bf3SSimon J. Gerraty 189*c59c3bf3SSimon J. Gerraty 190*c59c3bf3SSimon J. Gerraty# this often helps with debugging 191*c59c3bf3SSimon J. Gerraty.c.cpp-out: 192*c59c3bf3SSimon J. Gerraty @${COMPILE.c:N-c} -E ${.IMPSRC} | grep -v '^[ ]*$$' 193*c59c3bf3SSimon J. Gerraty 194*c59c3bf3SSimon J. Gerraty${CXX_SUFFIXES:%=%.cpp-out}: 195*c59c3bf3SSimon J. Gerraty @${COMPILE.cc:N-c} -E ${.IMPSRC} | grep -v '^[ ]*$$' 196