]> git.saurik.com Git - apple/xnu.git/blame - tools/tests/libMicro/Makefile.com
xnu-3248.60.10.tar.gz
[apple/xnu.git] / tools / tests / libMicro / Makefile.com
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
31include ../Makefile.benchmarks
32
33EXTRA_CFILES= \
34 exec_bin.c \
35 elided.c \
36 tattle.c
37
38#
39# some definitions to make getting compiler versions possible - avoid quotes
40#
41COMPILER_VERSION_CMD_cc=cc -V 2>&1 | egrep Sun
42COMPILER_VERSION_CMD_gcc=gcc -dumpversion
43COMPILER_VERSION_CMD=$(COMPILER_VERSION_CMD_$(CC))
44
45default: $(ALL) tattle
46
47cstyle:
48 for file in $(ALL:%=../%.c) $(EXTRA_CFILES:%=../%) ; \
49 do cstyle -p $$file ;\
50 done
51
52
53lint: libmicro.ln $(ALL:%=%.lint) $(EXTRA_CFILES:%.c=%.lint)
54
55
56$(EXTRA_CFILES:%.c=%.lint):
57 $(LINT) ../$(@:%.lint=%.c) -I. -mu -lc libmicro.ln -lm
58
59%.lint: ../%.c libmicro.ln
60 $(LINT) -mu $(CPPFLAGS) $< libmicro.ln -lpthread -lsocket -lnsl -lm
61
62%.o: ../%.c
63 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
64
65libmicro.ln: ../libmicro.c ../libmicro_main.c ../libmicro.h ../benchmark_*.c
66 $(LINT) -muc $(CPPFLAGS) ../libmicro.c ../libmicro_main.c ../benchmark_*.c
67
68CPPFLAGS+= -D_REENTRANT
69
70bind_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
71cascade_flock_EXTRA_LIBS=$(UCBLIB)
72close_tcp_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
73connection_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
74fcntl_ndelay_EXTRA_LIBS=$(SOCKLIB)
75getpeername_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
76getsockname_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
77listen_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
78log_EXTRA_LIBS=$(MATHLIB)
79pipe_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
80poll_EXTRA_LIBS=$(SOCKLIB)
81select_EXTRA_LIBS=$(SOCKLIB)
82setsockopt_EXTRA_LIBS=$(NSLLIB) $(SOCKLIB)
83socket_EXTRA_LIBS=$(SOCKLIB)
84socketpair_EXTRA_LIBS=$(SOCKLIB)
85
86BENCHMARK_FUNCS= \
87 benchmark_init.o \
88 benchmark_fini.o \
89 benchmark_initrun.o \
90 benchmark_finirun.o \
91 benchmark_initbatch.o \
92 benchmark_finibatch.o \
93 benchmark_initworker.o \
94 benchmark_finiworker.o \
95 benchmark_optswitch.o \
96 benchmark_result.o
97
98recurse_EXTRA_DEPS=recurse2.o
99
100
101recurse: $(recurse_EXTRA_DEPS)
102
103libmicro.a: libmicro.o libmicro_main.o $(BENCHMARK_FUNCS)
104 $(AR) -cr libmicro.a libmicro.o libmicro_main.o $(BENCHMARK_FUNCS)
105
106tattle: ../tattle.c libmicro.a
107 echo "char * compiler_version = \""`$(COMPILER_VERSION_CMD)`"\";" > tattle.h
108 echo "char * CC = \""$(CC)"\";" >> tattle.h
109 echo "char * extra_compiler_flags = \""$(extra_CFLAGS)"\";" >> tattle.h
110 $(CC) -o tattle $(CFLAGS) -I. ../tattle.c libmicro.a -lrt -lm
111 cp tattle ../tattle
112
113$(ELIDED_BENCHMARKS): ../elided.c
114 $(CC) -o $(@) ../elided.c
115
116%: libmicro.a %.o
117 $(CC) -o $(@) $(@).o $($(@)_EXTRA_DEPS) $(CFLAGS) libmicro.a $($(@)_EXTRA_LIBS) $(EXTRA_LIBS) -lpthread -lm
118
119exec: exec_bin
120
121exec_bin: exec_bin.o
122 $(CC) -o exec_bin $(CFLAGS) exec_bin.o
123
124FORCE:
125
126
127._KEEP_STATE:
128