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