freebsd-src/mk/posix.mk
Simon J. Gerraty a052cb4320 Import bmake-20220330
Most relevant change:

	o parse.c: try to include 'posix.mk' the first time
	.POSIX: is encountered, to allow for beter POSIX compliance.

Others

	o cond.c: make debug logging for comparisons less technical
	o lst.c: fix mem leak in Lst_Remove
	o job.c: fix echoing of command with '-' in silent target in jobs mode
	o var.c: make debug logs more readable
	prefer 'long long' over 'long' on 32-bit C99 platforms
	fix crash on .undef of an environment variable
2022-04-03 12:52:08 -07:00

105 lines
1.5 KiB
Makefile

# $Id: posix.mk,v 1.2 2022/03/25 23:55:37 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