xref: /illumos-gate/usr/src/cmd/ast/tools/Makefile (revision 379728489ed47862c4927c75771e767b9476c9c4)
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		print "#!/bin/sh"; \
44		[[ $(MACH) == i386 ]] && arch=i386 || arch=sun4; \
45		print "echo sol11.$$arch"; \
46	} >; $@
47	$(CHMOD) +x $@
48
49%.o: $(C_ASTINIT)/%.c
50	$(COMPILE.c) -o $@ $<
51	$(POST_PROCESS_O)
52
53%.o: $(C_AST)/src/lib/libast/port/%.c
54	$(COMPILE.c) -o $@ $<
55	$(POST_PROCESS_O)
56
57%: $(C_ASTINIT)/%.sh
58	$(RM) $@
59	{ \
60		echo 'USAGE_LICENSE="[-author?ATT]"'; \
61		cat $<; \
62	} >; $@
63	$(CHMOD) +x $@
64
65%: $(C_AST)/src/lib/libpp/%.sh
66	$(RM) $@
67	{ \
68		echo 'USAGE_LICENSE="[-author?ATT]"'; \
69		cat $<; \
70	} >; $@
71	$(CHMOD) +x $@
72
73$(CTOOLS): $(OBJS)
74	$(LINK.c) $@.o -o $@ $(LDLIBS)
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