xref: /illumos-gate/usr/src/cmd/sgs/lex/Makefile.com (revision e153cda9f9660e385e8f468253f80e59f5d454d7)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright 2015 Gary Mills
23# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27PROG=		lex
28
29MACHOBJS=	main.o sub1.o sub2.o sub3.o header.o parser.o
30POBJECTS=	$(MACHOBJS)
31POBJS=		$(POBJECTS:%=objs/%)
32
33LIBRARY=	libl.a
34VERS=		.1
35
36LIBOBJS=	allprint.o libmain.o reject.o yyless.o yywrap.o
37LIBOBJS_W=	allprint_w.o reject_w.o yyless_w.o
38LIBOBJS_E=	reject_e.o yyless_e.o
39OBJECTS=	$(LIBOBJS) $(LIBOBJS_W) $(LIBOBJS_E)
40
41FORMS=		nceucform ncform nrform
42
43include 	../../../../lib/Makefile.lib
44
45SRCDIR =	../common
46
47CSTD=	$(CSTD_GNU99)
48
49CERRWARN +=	-_gcc=-Wno-unused-label
50CERRWARN +=	-_gcc=-Wno-uninitialized
51CERRWARN +=	-_gcc=-Wno-parentheses
52
53# Override default source file derivation rule (in Makefile.lib)
54# from objects
55#
56MACHSRCS=	$(MACHOBJS:%.o=../common/%.c)
57LIBSRCS =	$(LIBOBJS:%.o=../common/%.c)
58SRCS=		$(MACHSRCS) $(LIBSRCS)
59
60LIBS =          $(DYNLIB) $(LINTLIB)
61
62# Append to LINTFLAGS and LINTFLAGS64 from lib/Makefile.lib
63LINTFLAGS +=	-erroff=E_NAME_MULTIPLY_DEF2 -erroff=E_FUNC_RET_MAYBE_IGNORED2
64LINTFLAGS64 +=	-erroff=E_NAME_MULTIPLY_DEF2 -erroff=E_FUNC_RET_MAYBE_IGNORED2
65
66LINTSRCS=	../common/llib-l$(LIBNAME)
67$(LINTLIB):=	SRCS = $(SRCDIR)/$(LINTSRC)
68
69INCLIST=	$(INCLIST_$(MACH)) -I../../include -I../../include/$(MACH)
70DEFLIST=	-DELF
71
72# It is not very clean to base the conditional definitions as below, but
73# this will have to do for now.
74#
75#$(LIBOBJS_W):=	DEFLIST = -DEUC -DJLSLEX  -DWOPTION -D$*=$*_w
76objs/%_w.o:=	DEFLIST = -DEUC -DJLSLEX  -DWOPTION -D$*=$*_w
77pics/%_w.o:=	DEFLIST = -DEUC -DJLSLEX  -DWOPTION -D$*=$*_w
78
79#$(LIBOBJS_E):=	DEFLIST = -DEUC -DJLSLEX  -DEOPTION -D$*=$*_e
80objs/%_e.o:=	DEFLIST = -DEUC -DJLSLEX  -DEOPTION -D$*=$*_e
81pics/%_e.o:=	DEFLIST = -DEUC -DJLSLEX  -DEOPTION -D$*=$*_e
82
83CPPFLAGS=	$(INCLIST) $(DEFLIST) $(CPPFLAGS.master)
84BUILD.AR=	$(AR) $(ARFLAGS) $@ `$(LORDER) $(OBJS) | $(TSORT)`
85
86LINTPOUT=	lint.out
87
88$(ROOTPROG):=	FILEMODE = 0555
89
90ROOTFORMS=	$(FORMS:%=$(ROOTSHLIBCCS)/%)
91
92ROOTLINTDIR=	$(ROOTLIBDIR)
93ROOTLINT=	$(LINTSRCS:../common/%=$(ROOTLINTDIR)/%)
94
95DYNLINKLIBDIR=	$(ROOTLIBDIR)
96DYNLINKLIB=	$(LIBLINKS:%=$(DYNLINKLIBDIR)/%)
97
98# Need to make sure lib-make's are warning free
99$(DYNLIB) :=	CFLAGS += $(CCVERBOSE)
100$(DYNLIB) :=	CFLAGS64 += $(CCVERBOSE)
101
102LDLIBS += -lc
103
104CLEANFILES +=	../common/parser.c $(LINTPOUT)
105CLOBBERFILES +=	$(LIBS) $(LIBRARY)
106
107lint: lintcheck
108