]> git.saurik.com Git - apple/xnu.git/blame - tools/tests/libMicro/Makefile.com.Darwin
xnu-4570.20.62.tar.gz
[apple/xnu.git] / tools / tests / libMicro / Makefile.com.Darwin
CommitLineData
b0d623f7
A
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms
5# of the Common Development and Distribution License
6# (the "License"). You may not use this file except
7# in compliance with the License.
8#
9# You can obtain a copy of the license at
10# src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing
13# permissions and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL
16# HEADER in each file and include the License file at
17# usr/src/OPENSOLARIS.LICENSE. If applicable,
18# add the following below this CDDL HEADER, with the
19# fields enclosed by brackets "[]" replaced with your
20# own identifying information: Portions Copyright [yyyy]
21# [name of copyright owner]
22#
23# CDDL HEADER END
24#
25
26#
27# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
28# Use is subject to license terms.
29#
30# ident "@(#)Makefile.com.Darwin 1.10 05/08/04 SMI"
31#
32
33include ../Makefile.benchmarks
34
35EXTRA_CFILES= \
36 exec_bin.c \
37 elided.c \
38 tattle.c
39
40#
41# some definitions to make getting compiler versions possible - avoid quotes
42#
43COMPILER_VERSION_CMD_cc=cc -V 2>&1 | egrep Sun
44COMPILER_VERSION_CMD_gcc=gcc -dumpversion
45COMPILER_VERSION_CMD=$(COMPILER_VERSION_CMD_$(CC))
46
47default: $(ALL) subdirs tattle
48
49cstyle:
50 for file in $(ALL:%=../%.c) $(EXTRA_CFILES:%=../%) ; \
51 do cstyle -p $$file ;\
52 done
53
54
55lint: libmicro.ln $(ALL:%=%.lint) $(EXTRA_CFILES:%.c=%.lint)
56
57
58$(EXTRA_CFILES:%.c=%.lint):
59 $(LINT) ../$(@:%.lint=%.c) -I. -mu -lc libmicro.ln -lm
60
61%.lint: ../%.c libmicro.ln
62 $(LINT) -mu $(CPPFLAGS) $< libmicro.ln -lpthread -lsocket -lnsl -lm
63
64%.o: ../%.c
65 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
66
67libmicro.ln: ../libmicro.c ../libmicro_main.c ../libmicro.h ../benchmark_*.c
68 $(LINT) -muc $(CPPFLAGS) ../libmicro.c ../libmicro_main.c ../benchmark_*.c
69
70CPPFLAGS+= -D_REENTRANT
71
72bind_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
73cascade_flock_EXTRA_LIBS=$(UCBLIB)
74close_tcp_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
75connection_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
76fcntl_ndelay_EXTRA_LIBS=$(SOCKLIB)
77getpeername_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
78getsockname_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
79listen_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
80log_EXTRA_LIBS=$(MATHLIB)
81pipe_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
82poll_EXTRA_LIBS=$(SOCKLIB)
83select_EXTRA_LIBS=$(SOCKLIB)
84setsockopt_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
85socket_EXTRA_LIBS=$(SOCKLIB)
86socketpair_EXTRA_LIBS=$(SOCKLIB)
87
88BENCHMARK_FUNCS= \
89 benchmark_init.o \
90 benchmark_fini.o \
91 benchmark_initrun.o \
92 benchmark_finirun.o \
93 benchmark_initbatch.o \
94 benchmark_finibatch.o \
95 benchmark_initworker.o \
96 benchmark_finiworker.o \
97 benchmark_optswitch.o \
98 benchmark_result.o
99
100recurse_EXTRA_DEPS=recurse2.o
101
102
103recurse: $(recurse_EXTRA_DEPS)
104
105libmicro.a: libmicro.o libmicro_main.o $(BENCHMARK_FUNCS)
106 $(AR) -cr libmicro.a libmicro.o libmicro_main.o $(BENCHMARK_FUNCS)
107 ranlib libmicro.a
108
109tattle: ../tattle.c libmicro.a
110 echo "char * compiler_version = \""`$(COMPILER_VERSION_CMD)`"\";" > tattle.h
111 echo "char * CC = \""$(CC)"\";" >> tattle.h
112 echo "char * extra_compiler_flags = \""$(extra_CFLAGS)"\";" >> tattle.h
113 $(CC) -o tattle $(CFLAGS) -I. ../tattle.c libmicro.a -lSystem -lm
114 cp tattle ../tattle
115
116$(ELIDED_BENCHMARKS): ../elided.c
117 $(CC) $(CFLAGS) -o $(@) ../elided.c
118
119%: libmicro.a %.o
120 $(CC) -o $(@) $(@).o $($(@)_EXTRA_DEPS) $(CFLAGS) libmicro.a $($(@)_EXTRA_LIBS) $(EXTRA_LIBS) -lpthread -lm
121
122exec: exec_bin
123
124exec_bin: exec_bin.o
125 $(CC) -o exec_bin $(CFLAGS) exec_bin.o
126
127# for apple added tests
128
129.PHONY: subdirs $(SUBDIRS)
130
131subdirs: $(SUBDIRS)
132
133$(SUBDIRS):
134 cd ..; $(MAKE) -C $@ ARCH=$(ARCH)
135
136
137
138FORCE:
139
140
141._KEEP_STATE:
142