xref: /illumos-gate/usr/src/cmd/ast/tools/Makefile (revision 0250c53ad267726f2438e3c6556199a0bbf588a2)
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
16SHELL= /usr/bin/ksh93
17
18CTOOLS= proto lcgen
19SHTOOLS= iffe package gentab
20
21TOOLS= $(CTOOLS) $(SHTOOLS) probe
22OBJS= $(CTOOLS:%=%.o)
23
24include $(SRC)/cmd/Makefile.cmd
25include ../Makefile.ast
26include $(SRC)/Makefile.native
27
28NATIVE_LIBS += libc.so
29
30all install install_h: $(TOOLS)
31_msg _feature:
32
33clean clobber:
34	$(RM) $(OBJS) $(TOOLS)
35
36package:
37	$(RM) $@
38	# The string returned by 'package' must match the value used by
39	# AT&T upstream, which is "i386" or "sun4", regardless of whether
40	# building 32- or 64-bit objects.
41	{ \
42		[[ $(MACH) == i386 ]] && arch=i386 || arch=sun4; \
43		print -e "#!/bin/sh\n\necho sol11.$$arch" > $@; \
44	}
45	$(CHMOD) +x $@
46
47%.o: $(C_ASTINIT)/%.c
48	$(COMPILE.c) -o $@ $<
49	$(POST_PROCESS_O)
50
51%.o: $(C_AST)/src/lib/libast/port/%.c
52	$(COMPILE.c) -o $@ $<
53	$(POST_PROCESS_O)
54
55AST_SH_ASSEMBLE= \
56	{ \
57		tf=$$(mktemp /tmp/ast.XXXXXXXXXX) && \
58		print 'USAGE_LICENSE="[-author?ATT]"' > $$tf && \
59		cat $< >> $$tf && \
60		mv $$tf $@; \
61	}
62
63%: $(C_ASTINIT)/%.sh
64	$(RM) $@
65	$(AST_SH_ASSEMBLE)
66	$(CHMOD) +x $@
67
68%: $(C_AST)/src/lib/libpp/%.sh
69	$(RM) $@
70	$(AST_SH_ASSEMBLE)
71	$(CHMOD) +x $@
72
73$(CTOOLS): $(OBJS)
74	$(LINK.c) $@.o -o $@
75	$(POST_PROCESS)
76
77probe: $(C_ASTINIT)/C+probe $(C_ASTINIT)/make.probe
78	$(CAT) $(C_ASTINIT)/C+probe $(C_ASTINIT)/make.probe > $@
79	$(CHMOD) +x $@
80
81STACKPROTECT= none
82
83CERRWARN += -_gcc=-Wno-parentheses
84CERRWARN += -_gcc=-Wno-implicit-fallthrough
85CERRWARN += -_gcc=-Wno-unused-value
86CERRWARN += $(CNOWARN_UNINIT)
87SMATCH= off
88
89.KEEP_STATE:
90.PARALLEL: $(TOOLS)
91