Create Ravenports release 20230628.1
[ravenports.git] / Mk / sys.mk
1 # sys.mk required by bmake
2
3 .SUFFIXES:      .out .o .c .cc .cpp .cxx .C .y .l .S .s .sh
4
5 AR?=            ar
6 AS?=            as
7 .if "${.MAKE.OS.NAME}" == "Darwin"
8 CC?=            gcc
9 CXX?=           g++
10 .else
11 CC?=            cc
12 CXX?=           c++
13 .endif
14 CC_LINK?=       ${CC}
15 CXX_LINK?=      ${CXX}
16 CPP?=           cpp
17 ECHO?=          echo
18 INSTALL?=       install
19 LEX?=           lex
20 LD?=            ld
21 MAKE?=          make
22 SHELL?=         sh
23
24 .sh:
25         cp -p ${.IMPSRC} ${.TARGET}
26         chmod a+x ${.TARGET}
27
28 .c:
29         ${CC} ${_${.IMPSRC:T}_FLAGS} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
30
31 .c.o:
32         ${CC} ${_${.IMPSRC:T}_FLAGS} ${CFLAGS} -c ${.IMPSRC}
33
34 .cc .cpp .cxx .C:
35         ${CXX} ${_${.IMPSRC:T}_FLAGS} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
36
37 .cc.o .cpp.o .cxx.o .C.o:
38         ${CXX} ${_${.IMPSRC:T}_FLAGS} ${CXXFLAGS} -c ${.IMPSRC}
39
40 .S.o:
41         ${CC} ${_${.IMPSRC:T}_FLAGS} ${CFLAGS} -c ${.IMPSRC}
42
43 .s.o:
44         ${AS} ${_${.IMPSRC:T}_FLAGS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
45
46 # XXX not -j safe
47 .y.o:
48         ${YACC:Uyacc -d} ${YFLAGS} ${.IMPSRC}
49         ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
50         rm -f y.tab.c
51
52 .l.o:
53         ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
54         ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET}
55         rm -f ${.PREFIX}.tmp.c
56
57 # XXX not -j safe
58 .y.c:
59         ${YACC} ${YFLAGS} ${.IMPSRC}
60         mv y.tab.c ${.TARGET}
61
62 .l.c:
63         ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET}
64
65 .s.out .c.out .o.out:
66         ${CC} ${_${.IMPSRC:T}_FLAGS} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
67
68 # XXX not -j safe
69 .y.out:
70         ${YACC:Uyacc -d} ${YFLAGS} ${.IMPSRC}
71         ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
72         rm -f y.tab.c
73
74 .l.out:
75         ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
76         ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
77         rm -f ${.PREFIX}.tmp.c
78
79 .if exists(/etc/make.conf)
80 .include "/etc/make.conf"
81 .endif
82
83 # Tell bmake to expand -V VAR by default
84 .MAKE.EXPAND_VARIABLES?= yes