OSDN Git Service

d7d15150176b927a0c87a6905f0580be2fcd2053
[pf3gnuchains/pf3gnuchains3x.git] / winsup / testsuite / Makefile.in
1 # Makefile.in for Cygwin's testsuite.
2 # Copyright 2000, 2001, 2002, 2003, 2005, 2006 Red Hat, Inc.
3 #
4 # This file is part of Cygwin.
5 #
6 # This software is a copyrighted work licensed under the terms of the
7 # Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
8 # details.
9
10 # This makefile requires GNU make.
11
12 SHELL:=@SHELL@
13 srcdir:=@srcdir@
14 objdir:=.
15 libltp_srcdir=$(srcdir)/libltp
16
17 VPATH:=$(srcdir):$(libltp_srcdir)/lib
18
19 target_alias:=@target_alias@
20 build_alias:=@build_alias@
21 host_alias:=@host_alias@
22
23 DESTDIR=
24 prefix:=${DESTDIR}@prefix@
25
26 program_transform_name:=@program_transform_name@
27 exec_prefix:=${DESTDIR}@exec_prefix@
28 bindir:=${DESTDIR}@bindir@
29 libdir:=${DESTDIR}@libdir@
30 ifeq ($(target_alias),$(host_alias))
31 ifeq ($(build_alias),$(host_alias))
32 tooldir:=$(exec_prefix)
33 else
34 tooldir:=$(exec_prefix)/$(target_alias)
35 endif
36 else
37 tooldir:=$(exec_prefix)/$(target_alias)
38 endif
39 datadir:=${DESTDIR}@datadir@
40 infodir:=${DESTDIR}@infodir@
41 includedir:=${DESTDIR}@includedir@
42
43 TESTSUP_INCLUDES:=-I$(libltp_srcdir)/include
44
45 #
46 # --enable options from configure
47 #
48
49 CC:=@CC@
50 # FIXME: Which is it, CC or CC_FOR_TARGET?
51 CC_FOR_TARGET:=$(CC)
52 ifneq (,$(CFLAGS))
53   override CFLAGS+= -MD $(TESTSUP_INCLUDES)
54 else
55   CFLAGS:=@CFLAGS@ -MD $(TESTSUP_INCLUDES)
56 endif
57
58 AR:=@AR@
59 AR_FLAGS:=qv
60
61 #
62 # Include common definitions for winsup directory
63 #
64 include $(srcdir)/../Makefile.common
65
66 override CC:=$(CC) $(GCC_INCLUDE)
67 export CC
68
69 RUNTESTFLAGS =
70
71 ifdef VERBOSE
72     RUNTESTFLAGS = -v
73 endif
74
75 RUNTIME=$(cygwin_build)/cygwin0.dll $(cygwin_build)/libcygwin0.a
76
77 TESTSUP_LIB_NAME:=libltp.a
78 TESTSUP_OFILES:=${sort ${addsuffix .o,${basename ${notdir ${wildcard $(libltp_srcdir)/lib/*.c}}}}}
79
80 override ALL_CFLAGS:=${filter-out -O%,$(ALL_CFLAGS)}
81 override COMPILE_CC:=${filter-out -O%,$(COMPILE_CC)}
82 override CFLAGS:=${filter-out -O%,$(CFLAGS)}
83 export CFLAGS
84
85 .PHONY: all force dll_ofiles install all_target install_target install_host
86
87 .SUFFIXES:
88 .SUFFIXES: .c .cc .def .a .o .d
89
90 all: $(TESTSUP_LIB_NAME)
91
92 force:
93
94 install:
95
96 install_host:
97
98 clean:
99         -rm -f *.o *.dll *.a *.exp junk *.bak *.base *.exe testsuite/* *.d *.dat
100
101 maintainer-clean realclean: clean
102         @echo "This command is intended for maintainers to use;"
103         @echo "it deletes files that may require special tools to rebuild."
104         -rm -fr configure
105
106 # Rule to build libltp.a
107
108 $(TESTSUP_LIB_NAME): $(TESTSUP_OFILES)
109         $(AR) rcv temp.a $(TESTSUP_OFILES)
110         mv temp.a $(TESTSUP_LIB_NAME)
111
112 $(RUNTIME) : $(cygwin_build)/Makefile
113         @$(MAKE) --no-print-dir -C $(@D) $(@F)
114
115 # Rule to make stub library used by "make check"
116
117 #\f
118
119 # These targets are for the dejagnu testsuites. The file site.exp
120 # contains global variables that all the testsuites will use.
121
122 # Set to $(target_alias)/ for cross.
123 target_subdir = @target_subdir@
124
125 site.exp: ./config.status Makefile
126         @echo "Making a new config file..."
127         -@rm -f ./tmp?
128         @touch site.exp
129         -@mv site.exp site.bak
130         @echo "## these variables are automatically generated by make ##" > ./tmp0
131         @echo "# Do not edit here. If you wish to override these values" >> ./tmp0
132         @echo "# add them to the last section" >> ./tmp0
133         @echo "set rootme \"`pwd`\"" >> ./tmp0
134         @echo "set runtime_root \"\$$rootme/../cygwin\"" >> ./tmp0
135         @echo "set srcdir \"`cd ${srcdir}; pwd`\"" >> ./tmp0
136         @echo "set host_triplet $(host_canonical)" >> ./tmp0
137         @echo "set build_triplet $(build_canonical)" >> ./tmp0
138         @echo "set target_triplet $(target)" >> ./tmp0
139         @echo "set target_alias $(target_alias)" >> ./tmp0
140         @echo "set CC \"$(CC)\"" >> ./tmp0
141 # CFLAGS is set even though it's empty to show we reserve the right to set it.
142         @echo "set CFLAGS \"$(ALL_CFLAGS)\"" >> ./tmp0
143         echo "set tmpdir $(objdir)/testsuite" >> ./tmp0
144         @echo "set ltp_includes \"$(libltp_srcdir)/include\"" >> ./tmp0
145         @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
146         @cat ./tmp0 > site.exp
147         @cat site.bak | sed \
148                 -e '1,/^## All variables above are.*##/ d' >> site.exp
149         -@rm -f ./tmp?
150
151 testsuite/site.exp: site.exp
152         if [ -d testsuite ]; then \
153           true; \
154         else \
155           mkdir testsuite; \
156         fi
157         rm -rf testsuite/site.exp
158         cp site.exp testsuite/site.exp
159
160 # Note: we set the PATH so that we can pick up cygwin0.dll
161
162 check: $(TESTSUP_LIB_NAME) $(RUNTIME) cygrun.exe testsuite/site.exp
163         cd testsuite; \
164         export EXPECT=expect ; \
165         if [ -f $(bupdir2)/expect/expect ] ; then  \
166            TCL_LIBRARY=`cd .. ; cd ${srcdir}/../../tcl/library ; pwd` ; \
167             export TCL_LIBRARY ; fi ; \
168         PATH=$(bupdir)/cygwin:$${PATH} ;\
169         runtest --tool winsup $(RUNTESTFLAGS) ;\
170
171 cygrun.o: cygrun.c
172         $(CC) $(MINGW_CFLAGS) -o $@ -c $<
173
174 cygrun.exe : cygrun.o
175         $(CC) ${MINGW_LDFLAGS} -mno-cygwin -o $@ $<