xref: /titanic_41/usr/src/cmd/sort/Makefile.com (revision 54925bf60766fbb4f1f2d7c843721406a7b7a3fb)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28# sort(1) Makefile.com
29#
30# Debugging targets
31#   sort provides a number of debugging options to simplify failure analysis.
32#
33#   debug		provides symbol information and sets DEBUG; includes
34#			convert, invoke
35#   stats		builds binaries with statistics reporting enabled
36#   convert		builds convert binaries (converts input to collation
37#			vectors)
38#   invoke		builds invoke binaries (allows inspection of options
39#			parser outcome)
40#
41# Debugging #defines
42#   DEBUG		activate assertions; allow wider range of memory
43#			settings (-S)
44#   DEBUG_FORCE_WIDE	force all i/o through wide streams
45#   DEBUG_DISALLOW_MMAP	force all i/o through stdio or wide streams
46#   DEBUG_NO_CACHE_TEMP	do not cache last sorted portion in memory; write all
47#			data to temporary files before merge
48#
49
50PROG = sort
51XPG4PROG = sort
52
53BASE_OBJS = \
54	check.o \
55	fields.o \
56	initialize.o \
57	internal.o \
58	merge.o \
59	options.o \
60	streams.o \
61	streams_array.o \
62	streams_mmap.o \
63	streams_stdio.o \
64	streams_wide.o \
65	utility.o
66OBJS =	main.o $(BASE_OBJS)
67INVOKE_OBJS = invoke.o $(BASE_OBJS)
68CONVERT_OBJS = convert.o $(BASE_OBJS)
69STATS_OBJS = main.o statistics.o $(BASE_OBJS)
70
71XPG4OBJS = $(OBJS:%.o=xpg4_%.o)
72SRCS =  $(OBJS:%.o=../common/%.c)
73LNTS =	$(OBJS:%.o=%.ln)
74CLEANFILES = $(OBJS) $(XPG4OBJS) $(LNTS)
75
76include ../../Makefile.cmd
77
78SED =		sed
79DCFILE = 	$(PROG).dc
80
81SPACEFLAG =
82SPACEFLAG64 =
83
84CFLAGS +=	$(CCVERBOSE) $(SORT_DEBUG)
85CFLAGS64 +=	$(CCVERBOSE) $(SORT_DEBUG)
86CPPFLAGS +=	-D_FILE_OFFSET_BITS=64
87LINTFLAGS +=	-U_FILE_OFFSET_BITS
88
89$(XPG4)	:=	CFLAGS += -DXPG4
90
91debug :=	SORT_DEBUG = -g -DDEBUG $(ILDOFF)
92debug :=	COPTFLAG =
93debug :=	COPTFLAG64 =
94stats	:=	SORT_DEBUG = -g -DSTATS -DDEBUG $(ILDOFF)
95stats	:=	COPTFLAG =
96stats	:=	COPTFLAG64 =
97
98.KEEP_STATE :
99
100.PARALLEL : $(OBJS) $(XPG4OBJS) $(LNTS)
101
102all : $(PROG) $(XPG4)
103
104debug : $(PROG) convert invoke
105
106lint : $(LNTS)
107	$(LINT.c) $(LINTFLAGS) $(LNTS) $(LDLIBS)
108
109clean :
110	$(RM) $(CLEANFILES)
111
112include ../../Makefile.targ
113
114# rules for $(PROG) and $(XPG4)
115
116$(PROG) : $(OBJS)
117	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
118	$(POST_PROCESS)
119
120$(XPG4) : $(XPG4OBJS)
121	$(LINK.c) -o $@ $(XPG4OBJS) $(LDLIBS)
122	$(POST_PROCESS)
123
124invoke: $(INVOKE_OBJS)
125	$(LINK.c) -o $@ $(INVOKE_OBJS) $(LDLIBS)
126
127convert: $(CONVERT_OBJS)
128	$(LINK.c) -o $@ $(CONVERT_OBJS) $(LDLIBS)
129
130stats: $(STATS_OBJS)
131	$(LINK.c) -o $@ $(STATS_OBJS) $(LDLIBS)
132
133%.o : ../common/%.c
134	$(COMPILE.c) -o $@ $<
135	$(POST_PROCESS_O)
136
137xpg4_%.o : ../common/%.c
138	$(COMPILE.c) -o $@ $<
139	$(POST_PROCESS_O)
140
141%.o : ../common/%.h types.h
142
143xpg4_%.o : ../common/%.h types.h
144
145%.ln: ../common/%.c
146	$(LINT.c) $(LINTFLAGS) -c $<
147