xref: /titanic_41/usr/src/cmd/sort/Makefile.com (revision bbaa8b60dd95d714741fc474adad3cf710ef4efd)
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
27#
28# Debugging targets
29#   sort provides a number of debugging options to simplify failure analysis.
30#
31#   debug		provides symbol information and sets DEBUG; includes
32#			convert, invoke
33#   stats		builds binaries with statistics reporting enabled
34#   convert		builds convert binaries (converts input to collation
35#			vectors)
36#   invoke		builds invoke binaries (allows inspection of options
37#			parser outcome)
38#
39# Debugging #defines
40#   DEBUG		activate assertions; allow wider range of memory
41#			settings (-S)
42#   DEBUG_FORCE_WIDE	force all i/o through wide streams
43#   DEBUG_DISALLOW_MMAP	force all i/o through stdio or wide streams
44#   DEBUG_NO_CACHE_TEMP	do not cache last sorted portion in memory; write all
45#			data to temporary files before merge
46#
47
48PROG = sort
49XPG4PROG = sort
50
51BASE_OBJS = \
52	check.o \
53	fields.o \
54	initialize.o \
55	internal.o \
56	merge.o \
57	options.o \
58	streams.o \
59	streams_array.o \
60	streams_mmap.o \
61	streams_stdio.o \
62	streams_wide.o \
63	utility.o
64OBJS =	main.o $(BASE_OBJS)
65INVOKE_OBJS = invoke.o $(BASE_OBJS)
66CONVERT_OBJS = convert.o $(BASE_OBJS)
67STATS_OBJS = main.o statistics.o $(BASE_OBJS)
68
69XPG4OBJS = $(OBJS:%.o=xpg4_%.o)
70SRCS =  $(OBJS:%.o=../common/%.c)
71LNTS =	$(OBJS:%.o=%.ln)
72CLEANFILES = $(OBJS) $(XPG4OBJS) $(LNTS)
73
74include ../../Makefile.cmd
75
76SED =		sed
77DCFILE = 	$(PROG).dc
78
79SPACEFLAG =
80SPACEFLAG64 =
81
82CFLAGS +=	$(CCVERBOSE) $(SORT_DEBUG)
83CFLAGS64 +=	$(CCVERBOSE) $(SORT_DEBUG)
84CPPFLAGS +=	-D_FILE_OFFSET_BITS=64
85LINTFLAGS +=	-U_FILE_OFFSET_BITS
86
87CERRWARN +=	-_gcc=-Wno-parentheses
88CERRWARN +=	-_gcc=-Wno-uninitialized
89CERRWARN +=	-_gcc=-Wno-unused-function
90
91$(XPG4)	:=	CFLAGS += -DXPG4
92
93debug :=	SORT_DEBUG = -g -DDEBUG $(ILDOFF)
94debug :=	COPTFLAG =
95debug :=	COPTFLAG64 =
96stats	:=	SORT_DEBUG = -g -DSTATS -DDEBUG $(ILDOFF)
97stats	:=	COPTFLAG =
98stats	:=	COPTFLAG64 =
99
100.KEEP_STATE :
101
102.PARALLEL : $(OBJS) $(XPG4OBJS) $(LNTS)
103
104all : $(PROG) $(XPG4)
105
106debug : $(PROG) convert invoke
107
108lint : $(LNTS)
109	$(LINT.c) $(LINTFLAGS) $(LNTS) $(LDLIBS)
110
111clean :
112	$(RM) $(CLEANFILES)
113
114include ../../Makefile.targ
115
116# rules for $(PROG) and $(XPG4)
117
118$(PROG) : $(OBJS)
119	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
120	$(POST_PROCESS)
121
122$(XPG4) : $(XPG4OBJS)
123	$(LINK.c) -o $@ $(XPG4OBJS) $(LDLIBS)
124	$(POST_PROCESS)
125
126invoke: $(INVOKE_OBJS)
127	$(LINK.c) -o $@ $(INVOKE_OBJS) $(LDLIBS)
128
129convert: $(CONVERT_OBJS)
130	$(LINK.c) -o $@ $(CONVERT_OBJS) $(LDLIBS)
131
132stats: $(STATS_OBJS)
133	$(LINK.c) -o $@ $(STATS_OBJS) $(LDLIBS)
134
135%.o : ../common/%.c
136	$(COMPILE.c) -o $@ $<
137	$(POST_PROCESS_O)
138
139xpg4_%.o : ../common/%.c
140	$(COMPILE.c) -o $@ $<
141	$(POST_PROCESS_O)
142
143%.o : ../common/%.h types.h
144
145xpg4_%.o : ../common/%.h types.h
146
147%.ln: ../common/%.c
148	$(LINT.c) $(LINTFLAGS) -c $<
149