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