blob: b7cb9ef32108b3822cfd3d9de0a6ee742b11232d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
# SPDX-License-Identifier: BSD-2-Clause
#
# $Id: posix.mk,v 1.3 2024/02/17 17:26:57 sjg Exp $
#
# @(#) Copyright (c) 2022, Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
# Permission to copy, redistribute or otherwise
# use this file is hereby granted provided that
# the above copyright notice and this notice are
# left intact.
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
#
# The minimal set of rules required by POSIX
.if !defined(%POSIX)
.error ${.newline}Do not inlcude this directly, put .POSIX: at start of Makefile
.endif
.if ${.MAKEFLAGS:M-r} == ""
# undo some work done by sys.mk
.SUFFIXES:
.undef ARFLAGS
.undef CC CFLAGS
.undef FC FFLAGS
.undef LDFLAGS LFLAGS
.undef RANLIBFLAGS
.undef YFLAGS
.endif
.SUFFIXES: .o .c .y .l .a .sh .f
# these can still be set via environment
AR ?= ar
ARFLAGS ?= -rv
CC ?= c99
CFLAGS ?= -O
FC ?= fort77
FFLAGS ?= -O 1
LDFLAGS ?=
LEX ?= lex
LFLAGS ?=
RANLIBFLAGS ?= -D
YACC ?= yacc
YFLAGS ?=
.c:
${CC} ${CFLAGS} ${LDFLAGS} -o $@ $<
.f:
${FC} ${FFLAGS} ${LDFLAGS} -o $@ $<
.sh:
cp $< $@
chmod a+x $@
.c.o:
${CC} ${CFLAGS} -c $<
.f.o:
${FC} ${FFLAGS} -c $<
.y.o:
${YACC} ${YFLAGS} $<
${CC} ${CFLAGS} -c y.tab.c
rm -f y.tab.c
mv y.tab.o $@
.l.o:
${LEX} ${LFLAGS} $<
${CC} ${CFLAGS} -c lex.yy.c
rm -f lex.yy.c
mv lex.yy.o $@
.y.c:
${YACC} ${YFLAGS} $<
mv y.tab.c $@
.l.c:
${LEX} ${LFLAGS} $<
mv lex.yy.c $@
.c.a:
${CC} -c ${CFLAGS} $<
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.f.a:
${FC} -c ${FFLAGS} $<
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
|