1#
2# This file and its contents are supplied under the terms of the
3# Common Development and Distribution License ("CDDL"), version 1.0.
4# You may only use this file in accordance with the terms of version
5# 1.0 of the CDDL.
6#
7# A full copy of the text of the CDDL should have accompanied this
8# source.  A copy of the CDDL is also available via the Internet at
9# http://www.illumos.org/license/CDDL.
10#
11
12#
13# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
14#
15
16include ../Makefile.com
17include ../../Makefile.iffe
18
19GENCONF= conflim.h conftab.c conftab.h
20LCCONF= lc.h lctab.c
21
22# Unfortunately, due to differences in the "sed" command implemented in
23# various illumos distributions, we can't portably use 'sed -i' here.
24clean_%: %
25	{ \
26		tf=$$(mktemp /tmp/iffe.XXXXXXXXXX) && \
27		$(SED) < "$<" > "$$tf" '$(SEDPATTERN)' && \
28		$(CP) -p "$$tf" "$<" && \
29		$(RM) "$$tf"; \
30	}
31
32conftab.c: $(ASTSRC)/comp/conf.tab
33	PATH=$(IFFEPATH) \
34	    $(SHELL) $(ASTSRC)/comp/conf.sh -v $(ASTSRC)/comp/conf.tab \
35	    $(IFFEC)
36conflim.h conftab.h: conftab.c
37
38lctab.c: $(ASTSRC)/port/lc.tab
39	$(AST_LCGEN) $(LCCONF) < $(ASTSRC)/port/lc.tab
40lc.h: lctab.c
41
42FEATURE/limits: $(GENCONF)
43FEATURE/float: ast/ast_common.h
44
45cleaniffe: FRC
46	$(RM) $(FEATURES:%=FEATURE/%) $(GENCONF) $(LCCONF)
47
48generate: cleaniffe $(FEATURES:%=FEATURE/%) $(LCCONF) \
49	.WAIT $(GENCONF:%=clean_%) $(LCCONF:%=clean_%)
50