]> sourceware.org Git - newlib-cygwin.git/blob - winsup/cygwin/Makefile.in
5045b1f51021a7fa7b54dd46f381bb68499998d7
[newlib-cygwin.git] / winsup / cygwin / Makefile.in
1 # Makefile.in for Cygwin.
2 # Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 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
16 CONFIG_DIR:=$(srcdir)/config/@CONFIG_DIR@
17 VPATH:=$(srcdir):$(CONFIG_DIR):$(srcdir)/regex:$(srcdir)/regexp:$(srcdir)/lib
18
19 target_alias:=@target_alias@
20 build_alias:=@build_alias@
21 host_alias:=@host_alias@
22 prefix:=@prefix@
23
24 program_transform_name:=@program_transform_name@
25 exec_prefix:=@exec_prefix@
26 bindir:=@bindir@
27 libdir:=@libdir@
28 ifeq ($(target_alias),$(host_alias))
29 ifeq ($(build_alias),$(host_alias))
30 tooldir:=$(exec_prefix)
31 else
32 tooldir:=$(exec_prefix)/$(target_alias)
33 endif
34 else
35 tooldir:=$(exec_prefix)/$(target_alias)
36 endif
37 datadir:=@datadir@
38 infodir:=@infodir@
39 includedir:=@includedir@
40
41 override INSTALL:=@INSTALL@
42 override INSTALL_PROGRAM:=@INSTALL_PROGRAM@
43 override INSTALL_DATA:=@INSTALL_DATA@
44
45 #
46 # --enable options from configure
47 #
48 MT_SAFE:=@MT_SAFE@
49 DEFS:=@DEFS@
50
51 # cygheap_CFLAGS:=-fomit-frame-pointer
52 malloc_CFLAGS:=-fomit-frame-pointer
53 shared_CFLAGS:=-fomit-frame-pointer
54 cygthread_CFLAGS:=-fomit-frame-pointer
55 miscfuncs_CFLAGS:=-fomit-frame-pointer
56 fhandler_CFLAGS:=-fomit-frame-pointer
57 fhandler_clipboard_CFLAGS:=-fomit-frame-pointer
58 fhandler_console_CFLAGS:=-fomit-frame-pointer
59 fhandler_disk_file_CFLAGS:=-fomit-frame-pointer
60 fhandler_dsp_CFLAGS:=-fomit-frame-pointer
61 fhandler_floppy_CFLAGS:=-fomit-frame-pointer
62 fhandler_mem_CFLAGS:=-fomit-frame-pointer
63 fhandler_proc_CFLAGS:=-fomit-frame-pointer
64 fhandler_process_CFLAGS:=-fomit-frame-pointer
65 fhandler_random_CFLAGS:=-fomit-frame-pointer
66 fhandler_raw_CFLAGS:=-fomit-frame-pointer
67 fhandler_registry_CFLAGS:=-fomit-frame-pointer
68 fhandler_serial_CFLAGS:=-fomit-frame-pointer
69 fhandler_socket_CFLAGS:=-fomit-frame-pointer
70 fhandler_tape_CFLAGS:=-fomit-frame-pointer
71 fhandler_termios_CFLAGS:=-fomit-frame-pointer
72 fhandler_tty_CFLAGS:=-fomit-frame-pointer
73 fhandler_virtual_CFLAGS:=-fomit-frame-pointer
74 fhandler_windows_CFLAGS:=-fomit-frame-pointer
75 fhandler_zero_CFLAGS:=-fomit-frame-pointer
76 regcomp_CFLAGS=-fomit-frame-pointer
77 regerror_CFLAGS=-fomit-frame-pointer
78 regexec_CFLAGS=-fomit-frame-pointer
79 regfree_CFLAGS=-fomit-frame-pointer
80
81 CC:=@CC@
82 # FIXME: Which is it, CC or CC_FOR_TARGET?
83 CC_FOR_TARGET:=$(CC)
84 CFLAGS=@CFLAGS@
85 override CFLAGS+=-MMD ${$(*F)_CFLAGS}
86 CXX=@CXX@
87 CXXFLAGS=@CXXFLAGS@
88
89 AR:=@AR@
90 AR_FLAGS:=qv
91 RANLIB:=@RANLIB@
92 LD:=@LD@
93 DLLTOOL:=@DLLTOOL@
94 WINDRES:=@WINDRES@
95 AS:=@AS@
96 NM:=@NM@
97 LDSCRIPT:=cygwin.sc
98
99 #
100 # Include common definitions for winsup directory
101 #
102 include $(srcdir)/../Makefile.common
103
104 @SET_MAKE@
105
106 # Setup the testing framework, if you have one
107 EXPECT = `if [ -f $${rootme}/../../expect/expect$(EXEEXT) ] ; then \
108 echo $${rootme}/../../expect/expect$(EXEEXT) ; \
109 else echo expect ; fi`
110
111 RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
112 echo $${srcdir}/../dejagnu/runtest ; \
113 else echo runtest; fi`
114 RUNTESTFLAGS =
115
116 # Parameters used in building the cygwin.dll.
117 # We build as cygwin0.dll and rename at install time to overcome
118 # native rebuilding issues (we don't want the build tools to see a partially
119 # built cygwin.dll and attempt to use it instead of the old one).
120
121 DLL_NAME:=cygwin1.dll
122 TEST_DLL_NAME:=cygwin0.dll
123 TEST_LIB_NAME:=libcygwin0.a
124 DEF_FILE:=cygwin.def
125 DLL_ENTRY:=@DLL_ENTRY@
126
127 LIBGMON_A:=libgmon.a
128 CYGWIN_START:=crt0.o
129 GMON_START:=gcrt0.o
130
131 # Some things want these from libc, but they have their own static
132 # data which apps can get to, which is a pain in the dll, so we
133 # include them directly into the library.
134
135 LIBCOS:=${sort ${addsuffix .o,${basename ${notdir ${wildcard $(srcdir)/lib/*.c}}}} \
136 ${addsuffix .o,${basename ${notdir ${wildcard $(srcdir)/lib/*.cc}}}}}
137
138 # Build all source files in the config directory
139
140 EXTRA_DLL_OFILES:=${addsuffix .o,${basename ${notdir ${wildcard $(CONFIG_DIR)/*.c}}}}
141
142 EXTRA_OFILES=$(bupdir1)/libiberty/random.o $(bupdir1)/libiberty/strsignal.o
143
144 MALLOC_OFILES=@MALLOC_OFILES@
145
146 DLL_IMPORTS:=$(w32api_lib)/libkernel32.a
147
148 # Please maintain this list in sorted order, with maximum files per 80 col line
149 DLL_OFILES:=assert.o autoload.o cxx.o bsdlib.o cygheap.o cygthread.o dcrt0.o \
150 debug.o delqueue.o dir.o dlfcn.o dll_init.o dtable.o environ.o \
151 errno.o exceptions.o exec.o external.o fcntl.o fhandler.o \
152 fhandler_clipboard.o fhandler_console.o fhandler_disk_file.o \
153 fhandler_dsp.o fhandler_floppy.o fhandler_mem.o \
154 fhandler_proc.o fhandler_process.o fhandler_random.o \
155 fhandler_raw.o fhandler_registry.o fhandler_serial.o \
156 fhandler_socket.o fhandler_tape.o fhandler_termios.o \
157 fhandler_tty.o fhandler_virtual.o fhandler_windows.o \
158 fhandler_zero.o fnmatch.o fork.o glob.o grp.o heap.o init.o ioctl.o \
159 ipc.o localtime.o malloc_wrapper.o miscfuncs.o mmap.o msg.o \
160 net.o netdb.o ntea.o passwd.o path.o pinfo.o pipe.o poll.o pthread.o \
161 regcomp.o regerror.o regexec.o regfree.o registry.o resource.o \
162 scandir.o sched.o sec_acl.o sec_helper.o security.o select.o sem.o \
163 shared.o shm.o signal.o sigproc.o smallprint.o spawn.o strace.o \
164 strsep.o sync.o syscalls.o sysconf.o syslog.o termios.o thread.o \
165 times.o tty.o uinfo.o uname.o v8_regexp.o v8_regerror.o v8_regsub.o \
166 wait.o wincap.o window.o \
167 $(EXTRA_DLL_OFILES) $(EXTRA_OFILES) $(MALLOC_OFILES) $(MT_SAFE_OBJECTS)
168
169 GMON_OFILES:=gmon.o mcount.o profil.o
170
171 OBSOLETE_FUNCTIONS:=regcomp regerror regexec regfree regsub \
172 open acl aclcheck aclfrommode aclfrompbits \
173 aclfromtext aclsort acltomode acltopbits \
174 acltotext chown facl fchown fdopen fgetpos fopen \
175 freopen fseeko fsetpos fstat ftello ftruncate \
176 getegid geteuid getgid getgrent getgrgid getgrnam \
177 getgroups getpwuid getpwuid_r getuid initgroups \
178 lchown lseek lstat mknod mmap seekdir setegid seteuid \
179 setgid setgroups setregid setreuid setuid stat \
180 telldir truncate
181
182 NEW_FUNCTIONS:=regcomp posix_regcomp \
183 regerror posix_regerror \
184 regexec posix_regexec \
185 regfree posix_regfree \
186 open _open64 \
187 acl _acl32 \
188 aclcheck _aclcheck32 \
189 aclfrommode _aclfrommode32 \
190 aclfrompbits _aclfrompbits32 \
191 aclfromtext _aclfromtext32 \
192 aclsort _aclsort32 \
193 acltomode _acltomode32 \
194 acltopbits _acltopbits32 \
195 acltotext _acltotext32 \
196 chown _chown32 \
197 facl _facl32 \
198 fchown _fchown32 \
199 fdopen _fdopen64 \
200 fgetpos _fgetpos64 \
201 fopen _fopen64 \
202 freopen _freopen64 \
203 fseeko _fseeko64 \
204 fsetpos _fsetpos64 \
205 fstat _fstat64 \
206 ftello _ftello64 \
207 ftruncate _ftruncate64 \
208 getegid _getegid32 \
209 geteuid _geteuid32 \
210 getgid _getgid32 \
211 getgrent _getgrent32 \
212 getgrgid _getgrgid32 \
213 getgrnam _getgrnam32 \
214 getgroups _getgroups32 \
215 getpwuid _getpwuid32 \
216 getpwuid_r _getpwuid_r32 \
217 getuid _getuid32 \
218 initgroups _initgroups32 \
219 lchown _lchown32 \
220 lseek _lseek64 \
221 lstat _lstat64 \
222 mknod _mknod32 \
223 mmap _mmap64 \
224 seekdir _seekdir64 \
225 setegid _setegid32 \
226 seteuid _seteuid32 \
227 setgid _setgid32 \
228 setgroups _setgroups32 \
229 setregid _setregid32 \
230 setreuid _setreuid32 \
231 setuid _setuid32 \
232 stat _stat64 \
233 telldir _telldir64 \
234 truncate _truncate64
235
236 API_VER:=$(srcdir)/include/cygwin/version.h
237
238 PWD:=${shell pwd}
239 LIB_NAME:=$(PWD)/libcygwin.a
240 LIBSERVER:=@LIBSERVER@
241 SUBLIBS:=$(PWD)/libpthread.a $(PWD)/libm.a $(PWD)/libc.a
242 EXTRALIBS:=libautomode.a libbinmode.a libtextmode.a
243 INSTOBJS:=automode.o binmode.o textmode.o
244 TARGET_LIBS:=$(LIB_NAME) $(CYGWIN_START) $(GMON_START) $(LIBGMON_A) $(SUBLIBS) $(INSTOBJS) $(EXTRALIBS)
245 .PHONY: all force dll_ofiles install all_target install_target all_host install_host \
246 install install-libs install-headers -lgcc
247
248 .SUFFIXES:
249 .SUFFIXES: .c .cc .def .a .o .d .s
250
251 all_host=@all_host@
252 install_host=@install_host@
253
254 all: all_target $(all_host)
255
256 all_target: $(TARGET_LIBS)
257
258 all_host: $(TEST_LIB_NAME)
259
260 force:
261
262 install: install-libs install-headers install-man install_target \
263 $(install_host) $(install_target)
264
265 uninstall: uninstall-libs uninstall-headers uninstall-man
266
267 install-libs: $(TARGET_LIBS)
268 $(INSTALL_PROGRAM) $(TEST_DLL_NAME) $(bindir)/$(DLL_NAME); \
269 for i in $^; do \
270 $(INSTALL_DATA) $$i $(tooldir)/lib/`basename $$i` ; \
271 done
272
273 install-headers:
274 cd $(srcdir); \
275 for sub in `find include -name '[a-z]*' -type d -print | sort`; do \
276 for i in $$sub/*.h ; do \
277 $(INSTALL_DATA) $$i $(tooldir)/$$sub/`basename $$i` ; \
278 done ; \
279 done ; \
280 $(INSTALL_DATA) regex/regex.h $(tooldir)/include/regex.h
281
282 install-man:
283 cd $(srcdir); \
284 for i in `find . -type f -name '*.2'`; do \
285 $(INSTALL_DATA) $$i $(tooldir)/man/man2/`basename $$i` ; \
286 done; \
287 for i in `find . -type f -name '*.3'`; do \
288 $(INSTALL_DATA) $$i $(tooldir)/man/man3/`basename $$i` ; \
289 done; \
290 for i in `find . -type f -name '*.5'`; do \
291 $(INSTALL_DATA) $$i $(tooldir)/man/man5/`basename $$i` ; \
292 done; \
293 for i in `find . -type f -name '*.7'`; do \
294 $(INSTALL_DATA) $$i $(tooldir)/man/man7/`basename $$i` ; \
295 done
296
297 install_target:
298
299 install_host:
300
301
302 uninstall-libs: $(TARGET_LIBS)
303 rm -f $(bindir)/$(DLL_NAME); \
304 for i in $^; do \
305 rm -f $(tooldir)/lib/$$i ; \
306 done
307
308 uninstall-headers:
309 cd $(srcdir); \
310 for sub in `find include -name '[a-z]*' -type d -print | sort`; do \
311 for i in $$sub/*.h ; do \
312 rm -f $(tooldir)/$$sub/`basename $$i` ; \
313 done ; \
314 done ; \
315 rm -f $(tooldir)/include/regex.h
316
317 uninstall-man:
318 cd $(srcdir); \
319 for i in `find . -type f -name '*.2'`; do \
320 rm -f $(tooldir)/man/man2/`basename $$i` ; \
321 done; \
322 for i in `find . -type f -name '*.3'`; do \
323 rm -f $(tooldir)/man/man3/`basename $$i` ; \
324 done; \
325 for i in `find . -type f -name '*.5'`; do \
326 rm -f $(tooldir)/man/man5/`basename $$i` ; \
327 done; \
328 for i in `find . -type f -name '*.7'`; do \
329 rm -f $(tooldir)/man/man7/`basename $$i` ; \
330 done
331
332 clean:
333 -rm -f *.o *.dll *.a *.exp junk *.base version.cc regexp/*.o winver_stamp *.exe *.d *stamp* *_magic.h
334
335 maintainer-clean realclean: clean
336 @echo "This command is intended for maintainers to use;"
337 @echo "it deletes files that may require special tools to rebuild."
338 -rm -fr configure
339
340
341 # Rule to build cygwin.dll
342 $(TEST_DLL_NAME): $(LDSCRIPT) $(DLL_OFILES) $(DEF_FILE) $(DLL_IMPORTS) $(LIBSERVER) $(LIBC) $(LIBM) $(API_VER) Makefile winver_stamp
343 $(CXX) $(CXXFLAGS) $(nostdlib) -Wl,-T$(firstword $^) -Wl,--out-implib,cygdll.a -shared -o $@ \
344 -e $(DLL_ENTRY) $(DEF_FILE) $(DLL_OFILES) version.o winver.o \
345 $(MALLOC_OBJ) $(LIBSERVER) $(LIBM) $(LIBC) \
346 -lgcc $(DLL_IMPORTS)
347 @ln -f $@ new-$(DLL_NAME)
348
349 # Rule to build libcygwin.a
350 $(LIB_NAME): rmsym newsym $(TEST_DLL_NAME) $(LIBCOS)
351 /bin/sh ${word 1,$^} ./cygdll.a "$(NM)" "$(AR)" $(OBSOLETE_FUNCTIONS) || exit 0
352 /bin/sh ${word 2,$^} ./cygdll.a "$(AS)" "$(AR)" $(NEW_FUNCTIONS) || exit 0
353 (echo create $(LIB_NAME); echo addmod $(LIBCOS); echo addlib cygdll.a; echo save) | $(AR) -M
354 $(RANLIB) $@
355
356 # Rule to make stub library used by testsuite
357 # dependency set to $(LIB_NAME) to accommodate make -j2.
358 # Otherwise dlltool gets confused. cgf (11-16-2000)
359 $(TEST_LIB_NAME): $(LIB_NAME)
360 perl -p -e 'BEGIN{binmode(STDIN); binmode(STDOUT);}; s/cygwin1/cygwin0/g' < $? > $@
361
362 dll_ofiles: $(DLL_OFILES)
363
364 $(LIBGMON_A): $(GMON_OFILES) $(GMON_START)
365 $(AR) rcv $(LIBGMON_A) $(GMON_OFILES)
366
367 $(API_VER): $(srcdir)/cygwin.din
368 @echo Error: Version info is older than DLL API!
369 @false
370
371 version.cc winver.o: winver_stamp
372 @ :
373
374 shared_info_magic.h: cygmagic shared_info.h
375 /bin/sh ${word 1,$^} $@ "$(CC) -x c" ${word 2,$^} MOUNT_MAGIC 'class mount_info' SHARED_MAGIC 'class shared_info'
376
377 child_info_magic.h: cygmagic child_info.h
378 /bin/sh ${word 1,$^} $@ "$(CC) -x c" ${word 2,$^} CHILD_INFO_MAGIC 'class child_info'
379
380 dcrt0.o sigproc.o: child_info_magic.h
381
382 shared.o: shared_info_magic.h
383
384 $(PWD)/libpthread.a: speclib $(LIB_NAME) pthread.o thread.o
385 /bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
386
387 $(PWD)/libm.a: speclib $(LIB_NAME) $(LIBM)
388 /bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
389
390 $(PWD)/libc.a: speclib $(LIB_NAME) $(PWD)/libm.a libpthread.a
391 /bin/sh ${word 1, $^} -v $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
392
393 lib%.a: %.o
394 $(AR) cru $@ $?
395
396 winver_stamp: mkvers.sh include/cygwin/version.h winver.rc $(DLL_OFILES)
397 @echo "Making version.o and winver.o";\
398 $(SHELL) ${word 1,$^} ${word 2,$^} ${word 3,$^} $(WINDRES) && \
399 $(COMPILE_CXX) -o version.o version.cc && \
400 touch $@
401
402 -lgcc:
403 :
404
405 #\f
406
407 Makefile: cygwin.din
408
409 $(DEF_FILE): cygwin.din config.status
410 $(SHELL) config.status
411
412 winsup.h: config.h
413
414 deps:=${wildcard *.d}
415 ifneq (,$(deps))
416 include $(deps)
417 endif
This page took 0.056513 seconds and 4 git commands to generate.