1 # Makefile.in for Cygwin.
2 # Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
3 # 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.
5 # This file is part of Cygwin.
7 # This software is a copyrighted work licensed under the terms of the
8 # Cygwin license. Please consult the file "CYGWIN_LICENSE" for
10 # configure_input: @configure_input@
12 # This makefile requires GNU make.
15 target_builddir
:=@target_builddir@
16 winsup_srcdir
:=@winsup_srcdir@
17 configure_args
=@configure_args@
25 include ${srcdir}/..
/Makefile.common
27 # environment variables used by ccwrap
28 export CCWRAP_HEADERS
:=.
${srcdir}
29 export CCWRAP_SYSTEM_HEADERS
:=@cygwin_headers@ @newlib_headers@
30 export CCWRAP_DIRAFTER_HEADERS
:=@windows_headers@
32 VPATH
+=$(CONFIG_DIR
) $(srcdir)/regex
$(srcdir)/lib
$(srcdir)/libc
34 target_alias
:=@target_alias@
35 build_alias
:=@build_alias@
36 host_alias
:=@host_alias@
39 program_transform_name
:=@program_transform_name@
40 exec_prefix:=@
exec_prefix@
44 sysconfdir
:=@sysconfdir@
45 datarootdir
:=@datarootdir@
46 ifeq ($(target_alias
),$(host_alias
))
47 ifeq ($(build_alias
),$(host_alias
))
48 tooldir
:=$(exec_prefix)
50 tooldir
:=$(exec_prefix)/$(target_alias
)
53 tooldir
:=$(exec_prefix)/$(target_alias
)
57 includedir:=@
includedir@
59 override INSTALL
:=@INSTALL@
60 override INSTALL_PROGRAM
:=@INSTALL_PROGRAM@
61 override INSTALL_DATA
:=@INSTALL_DATA@
63 WINDOWS_LIBDIR
:=@windows_libdir@
65 cygserver_blddir
:=${target_builddir}/winsup
/cygserver
66 LIBSERVER
:=${cygserver_blddir}/libcygserver.a
68 LIBC
:=$(newlib_build
)/libc
/libc.a
69 LIBM
:=$(newlib_build
)/libm
/libm.a
70 CRT0
:=$(cygwin_build
)/crt0.o
73 # --enable options from configure
78 COMMON_CFLAGS
=-MMD
${$(*F
)_CFLAGS
} -Werror
-fmerge-constants
-ftracer
$(CCEXTRA
)
79 COMPILE.
cc+=${COMMON_CFLAGS} -mno-use-libstdc-wrappers
80 COMPILE.c
+=${COMMON_CFLAGS}
94 MKDIRP
:=$(INSTALL
) -m
755 -d
98 # Setup the testing framework, if you have one
99 EXPECT
= `if [ -f $${rootme}/../../expect/expect$(EXEEXT) ] ; then \
100 echo $${rootme}/../../expect/expect$(EXEEXT) ; \
101 else echo expect ; fi`
103 RUNTEST
= `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
104 echo $${srcdir}/../dejagnu/runtest ; \
105 else echo runtest; fi`
108 # Parameters used in building the cygwin.dll.
109 # We build as cygwin0.dll and rename at install time to overcome
110 # native rebuilding issues (we don't want the build tools to see a partially
111 # built cygwin.dll and attempt to use it instead of the old one).
113 DLL_NAME
:=cygwin1.dll
114 TEST_DLL_NAME
:=cygwin0.dll
115 TEST_LIB_NAME
:=libcygwin0.a
116 STATIC_LIB_NAME
:=libcygwin_s.a
118 DLL_ENTRY
:=@DLL_ENTRY@
124 toolopts
:=--ar=${AR} --as=${AS} --nm
=${NM} --objcopy
=${OBJCOPY}
126 ${srcdir}/speclib
${toolopts} \
128 --exclude
='(?i:dll)' \
130 --exclude
='^_main$$' \
133 # Some things want these from libc, but they have their own static
134 # data which apps can get to, which is a pain in the dll, so we
135 # include them directly into the library.
137 LIBCOS
:=${sort ${addsuffix .o
,${basename ${notdir ${wildcard $(srcdir)/lib
/*.c
}}}} \
138 ${addsuffix .o
,${basename ${notdir ${wildcard $(srcdir)/lib
/*.
cc}}}}}
140 # Build all source files in the config directory
142 EXTRA_DLL_OFILES
:=${addsuffix .o
,${basename ${notdir ${wildcard $(CONFIG_DIR
)/*.c
}}}}
146 MALLOC_OFILES
:=@MALLOC_OFILES@
148 DLL_IMPORTS
:=${shell $(CC
) -print-file-name
=w32api
/libkernel32.a
} ${shell $(CC
) -print-file-name
=w32api
/libntdll.a
}
152 DLL_OFILES
:=advapi32.o assert.o autoload.o bsdlib.o ctype.o
cxx.o cygheap.o \
153 cygthread.o cygtls.o cygwait.o cygxdr.o dcrt0.o debug.o devices.o \
154 dir.o dlfcn.o dll_init.o dtable.o environ.o errno.o exceptions.o \
155 exec.o external.o fcntl.o fenv.o fhandler.o fhandler_clipboard.o \
156 fhandler_console.o fhandler_dev.o fhandler_disk_file.o fhandler_dsp.o \
157 fhandler_fifo.o fhandler_floppy.o fhandler_mailslot.o fhandler_mem.o \
158 fhandler_netdrive.o fhandler_nodevice.o fhandler_proc.o \
159 fhandler_process.o fhandler_procnet.o fhandler_procsys.o \
160 fhandler_procsysvipc.o fhandler_random.o fhandler_raw.o \
161 fhandler_registry.o fhandler_serial.o fhandler_socket.o fhandler_tape.o \
162 fhandler_termios.o fhandler_tty.o fhandler_virtual.o fhandler_windows.o \
163 fhandler_zero.o flock.o fnmatch.o fork.o fts.o ftw.o getopt.o glob.o \
164 glob_pattern_p.o globals.o grp.o heap.o hookapi.o inet_addr.o \
165 inet_network.o init.o ioctl.o ipc.o kernel32.o libstdcxx_wrapper.o \
166 localtime.o lsearch.o malloc_wrapper.o minires-os-if.o minires.o \
167 miscfuncs.o mktemp.o mmap.o msg.o mount.o net.o netdb.o nfs.o nftw.o \
168 nlsfuncs.o ntea.o passwd.o path.o pinfo.o pipe.o poll.o posix_ipc.o \
169 pseudo-reloc.o pthread.o random.o regcomp.o regerror.o regexec.o regfree.o \
170 registry.o resource.o rexec.o rcmd.o scandir.o sched.o sec_acl.o \
171 sec_auth.o sec_helper.o security.o select.o sem.o setlsapwd.o shared.o \
172 shm.o sigfe.o signal.o sigproc.o smallprint.o spawn.o strace.o strfmon.o \
173 strfuncs.o strptime.o strsep.o strsig.o sync.o syscalls.o sysconf.o \
174 syslog.o termios.o thread.o timer.o times.o tls_pbuf.o tty.o uinfo.o \
175 uname.o wait.o wincap.o window.o winf.o wow64.o xsique.o \
176 $(EXTRA_DLL_OFILES
) $(EXTRA_OFILES
) $(MALLOC_OFILES
) $(MT_SAFE_OBJECTS
)
178 EXCLUDE_STATIC_OFILES
:=$(addprefix --exclude
=,\
188 override DLL_OFILES
:=$(patsubst %.o
,%_E
,${DLL_OFILES})
189 override EXCLUDE_STATIC_OFILES
:=$(patsubst %.o
,%_E
,${EXCLUDE_STATIC_OFILES})
190 override EXTRA_OFILES
=$(patsubst %.o
,%_E
,${DLL_OFILES}))
191 override MALLOC_OFILES
:=$(patsubst %.o
,%.E
,${MALLOC_OFILES})
194 GMON_OFILES
:=gmon.o mcount.o profil.o
196 NEW_FUNCTIONS
:=$(addprefix --replace
=,\
198 aclcheck
=_aclcheck32 \
199 aclfrommode
=_aclfrommode32 \
200 aclfrompbits
=_aclfrompbits32 \
201 aclfromtext
=_aclfromtext32 \
203 acltomode
=_acltomode32 \
204 acltopbits
=_acltopbits32 \
205 acltotext
=_acltotext32 \
218 ftruncate
=_ftruncate64 \
222 getgrent
=_getgrent32 \
223 getgrgid
=_getgrgid32 \
224 getgrnam
=_getgrnam32 \
225 getgroups
=_getgroups32 \
226 getpwuid
=_getpwuid32 \
227 getpwuid_r
=_getpwuid_r32 \
229 initgroups
=_initgroups32 \
239 setgroups
=_setgroups32 \
240 setregid
=_setregid32 \
241 setreuid
=_setreuid32 \
246 truncate
=_truncate64 \
249 API_VER
:=$(srcdir)/include/cygwin
/version.h
251 LIB_NAME
:=libcygwin.a
252 SUBLIBS
:=libpthread.a libutil.a
${CURDIR}/libm.a
${CURDIR}/libc.a libdl.a libresolv.a librt.a
253 EXTRALIBS
:=libautomode.a libbinmode.a libtextmode.a libtextreadmode.a
254 INSTOBJS
:=automode.o binmode.o textmode.o textreadmode.o
255 TARGET_LIBS
:=$(LIB_NAME
) $(CYGWIN_START
) $(GMON_START
) $(LIBGMON_A
) $(SUBLIBS
) $(INSTOBJS
) $(EXTRALIBS
)
257 ifneq "${filter -O%,$(CFLAGS)}" ""
258 cygheap_CFLAGS
:=-fomit-frame-pointer
259 cygthread_CFLAGS
:=-fomit-frame-pointer
260 cygtls_CFLAGS
:=-fomit-frame-pointer
261 cygwait_CFLAGS
=-fomit-frame-pointer
262 delqueue_CFLAGS
:=-fomit-frame-pointer
263 devices_CFLAGS
:=-fomit-frame-pointer
-Os
264 dir_CFLAGS
:=-fomit-frame-pointer
265 dlfcn_CFLAGS
:=-fomit-frame-pointer
266 dll_init_CFLAGS
:=-fomit-frame-pointer
267 dtable_CFLAGS
:=-fomit-frame-pointer
-fcheck-new
268 fcntl_CFLAGS
:=-fomit-frame-pointer
269 fenv_CFLAGS
:=-fomit-frame-pointer
270 fhandler_CFLAGS
:=-fomit-frame-pointer
271 fhandler_clipboard_CFLAGS
:=-fomit-frame-pointer
272 fhandler_console_CFLAGS
:=-fomit-frame-pointer
273 fhandler_disk_file_CFLAGS
:=-fomit-frame-pointer
274 fhandler_dsp_CFLAGS
:=-fomit-frame-pointer
275 fhandler_floppy_CFLAGS
:=-fomit-frame-pointer
276 fhandler_mem_CFLAGS
:=-fomit-frame-pointer
277 fhandler_netdrive_CFLAGS
:=-fomit-frame-pointer
278 fhandler_proc_CFLAGS
:=-fomit-frame-pointer
279 fhandler_process_CFLAGS
:=-fomit-frame-pointer
280 fhandler_random_CFLAGS
:=-fomit-frame-pointer
281 fhandler_raw_CFLAGS
:=-fomit-frame-pointer
282 fhandler_registry_CFLAGS
:=-fomit-frame-pointer
283 fhandler_serial_CFLAGS
:=-fomit-frame-pointer
284 fhandler_socket_CFLAGS
:=-fomit-frame-pointer
285 fhandler_syslog_CFLAGS
:=-fomit-frame-pointer
286 fhandler_tape_CFLAGS
:=-fomit-frame-pointer
287 fhandler_termios_CFLAGS
:=-fomit-frame-pointer
288 fhandler_tty_CFLAGS
:=-fomit-frame-pointer
289 fhandler_virtual_CFLAGS
:=-fomit-frame-pointer
290 fhandler_windows_CFLAGS
:=-fomit-frame-pointer
291 fhandler_zero_CFLAGS
:=-fomit-frame-pointer
292 flock_CFLAGS
:=-fomit-frame-pointer
293 grp_CFLAGS
:=-fomit-frame-pointer
294 libstdcxx_wrapper_CFLAGS
:=-fomit-frame-pointer
295 malloc_CFLAGS
:=-fomit-frame-pointer
-O3
296 malloc_wrapper_CFLAGS
:=-fomit-frame-pointer
297 miscfuncs_CFLAGS
:=-fomit-frame-pointer
298 net_CFLAGS
:=-fomit-frame-pointer
299 passwd_CFLAGS
:=-fomit-frame-pointer
300 path_CFLAGS
=-fomit-frame-pointer
301 regcomp_CFLAGS
=-fomit-frame-pointer
302 regerror_CFLAGS
=-fomit-frame-pointer
303 regexec_CFLAGS
=-fomit-frame-pointer
304 regfree_CFLAGS
=-fomit-frame-pointer
305 shared_CFLAGS
:=-fomit-frame-pointer
306 sync_CFLAGS
:=-fomit-frame-pointer
-O3
307 smallprint_CFLAGS
:=-fomit-frame-pointer
308 syscalls_CFLAGS
:=-fomit-frame-pointer
309 sysconf_CFLAGS
:=-fomit-frame-pointer
310 uinfo_CFLAGS
:=-fomit-frame-pointer
313 fhandler_proc_CFLAGS
+=-DUSERNAME
="\"$(USER)\"" -DHOSTNAME
="\"$(HOSTNAME)\""
314 fhandler_proc_CFLAGS
+=-DGCC_VERSION
="\"`$(CC) -v 2>&1 | tail -n 1`\""
316 _cygwin_crt0_common_STDINCFLAGS
:=yes
317 libstdcxx_wrapper_STDINCFLAGS
:=yes
320 .PHONY
: all force dll_ofiles
install all_target install_target all_host install_host \
321 install install-libs install-headers
324 install_host
=@install_host@
326 all: all_target
$(all_host
)
328 all_target
: $(TARGET_LIBS
)
330 all_host
: $(TEST_LIB_NAME
)
334 install: install-libs install-headers install-man install_target \
335 $(install_host
) $(install_target
)
337 uninstall: uninstall-libs uninstall-headers uninstall-man
339 install-libs
: $(TARGET_LIBS
)
340 @
$(MKDIRP
) $(DESTDIR
)$(bindir)
341 $(INSTALL_PROGRAM
) $(TEST_DLL_NAME
) $(DESTDIR
)$(bindir)/$(DLL_NAME
); \
343 $(INSTALL_DATA
) $$i $(DESTDIR
)$(tooldir
)/lib
/`basename $$i` ; \
345 cd
$(DESTDIR
)$(tooldir
)/lib
&& ln
-sf libcygwin.a libg.a
349 for sub in
`find include -name '[a-z]*' -type d -print | sort`; do \
350 $(MKDIRP
) $(DESTDIR
)$(tooldir
)/$$sub; \
351 for i in
$$sub/*.h
; do \
352 $(INSTALL_DATA
) $$i $(DESTDIR
)$(tooldir
)/$$sub/`basename $$i` ; \
357 @
$(MKDIRP
) $(DESTDIR
)$(mandir)/man2
$(DESTDIR
)$(mandir)/man3
$(DESTDIR
)$(mandir)/man5
$(DESTDIR
)$(mandir)/man7
359 for i in
`find . -type f -name '*.2'`; do \
360 $(INSTALL_DATA
) $$i $(DESTDIR
)$(mandir)/man2
/`basename $$i` ; \
362 for i in
`find . -type f -name '*.3'`; do \
363 $(INSTALL_DATA
) $$i $(DESTDIR
)$(mandir)/man3
/`basename $$i` ; \
365 for i in
`find . -type f -name '*.5'`; do \
366 $(INSTALL_DATA
) $$i $(DESTDIR
)$(mandir)/man5
/`basename $$i` ; \
368 for i in
`find . -type f -name '*.7'`; do \
369 $(INSTALL_DATA
) $$i $(DESTDIR
)$(mandir)/man7
/`basename $$i` ; \
376 uninstall-libs
: $(TARGET_LIBS
)
377 rm -f
$(bindir)/$(DLL_NAME
); \
379 rm -f
$(tooldir
)/lib
/$$i ; \
384 for sub in
`find include -name '[a-z]*' -type d -print | sort`; do \
385 for i in
$$sub/*.h
; do \
386 rm -f
$(tooldir
)/$$sub/`basename $$i` ; \
392 for i in
`find . -type f -name '*.2'`; do \
393 rm -f
$(tooldir
)/man
/man2
/`basename $$i` ; \
395 for i in
`find . -type f -name '*.3'`; do \
396 rm -f
$(tooldir
)/man
/man3
/`basename $$i` ; \
398 for i in
`find . -type f -name '*.5'`; do \
399 rm -f
$(tooldir
)/man
/man5
/`basename $$i` ; \
401 for i in
`find . -type f -name '*.7'`; do \
402 rm -f
$(tooldir
)/man
/man7
/`basename $$i` ; \
406 -rm -f
*.o
*.dll
*.dbg
*.a
*.exp junk
*.base version.
cc winver_stamp
*.exe
*.d
*stamp
* *_magic.h sigfe.s cygwin.def globals.h
$(srcdir)/tlsoffsets.h
$(srcdir)/devices.
cc
407 -@
$(MAKE
) -C
${cygserver_blddir} libclean
409 maintainer-clean
realclean: clean
410 @echo
"This command is intended for maintainers to use;"
411 @echo
"it deletes files that may require special tools to rebuild."
415 # Rule to build cygwin.dll
416 $(TEST_DLL_NAME
): $(LDSCRIPT
) dllfixdbg
$(DLL_OFILES
) $(LIBSERVER
) $(LIBC
) $(LIBM
) $(API_VER
) Makefile winver_stamp
417 $(CXX
) $(CXXFLAGS
) -L
${WINDOWS_LIBDIR} -Wl
,--gc-sections
$(nostdlib
) -Wl
,-T
$(firstword $^
) -static \
418 -Wl
,--heap
=0 -Wl
,--out-implib
,cygdll.a
-shared
-o
$@ \
419 -e
$(DLL_ENTRY
) $(DEF_FILE
) $(DLL_OFILES
) version.o winver.o \
420 $(MALLOC_OBJ
) $(LIBSERVER
) $(LIBM
) $(LIBC
) \
421 -lgcc
$(DLL_IMPORTS
) -Wl
,-Map
,cygwin.map
422 @
$(word 2,$^
) $(OBJDUMP
) $(OBJCOPY
) $@
${patsubst %0.dll
,%1.dbg
,$@
}
423 @ln
-f
$@ new-
$(DLL_NAME
)
425 # Rule to build libcygwin.a
426 $(LIB_NAME
): $(LIBCOS
) |
$(TEST_DLL_NAME
)
427 ${srcdir}/mkimport
${toolopts} ${NEW_FUNCTIONS} $@ cygdll.a
$^
429 ${STATIC_LIB_NAME}: mkstatic
${TEST_DLL_NAME}
430 perl
-d
$< -x
${EXCLUDE_STATIC_OFILES} --library
=${LIBC} --library
=${LIBM} --ar=${AR} $@ cygwin.map
432 # Rule to make stub library used by testsuite
433 # dependency set to $(LIB_NAME) to accommodate make -j2.
434 $(TEST_LIB_NAME
): $(LIB_NAME
)
435 perl
-p
-e
'BEGIN{binmode(STDIN); binmode(STDOUT);}; s/cygwin1/cygwin0/g' < $?
> $@
437 $(LIBSERVER
): ${cygserver_blddir}/Makefile
438 $(MAKE
) -C
${cygserver_blddir} libcygserver.a
440 ${cygserver_blddir}/Makefile
:
442 cd
${@D
} && exec
/bin
/sh
$(dir ${srcdir})/cygserver
/configure
${configure_args}
444 dll_ofiles
: $(DLL_OFILES
)
446 $(LIBGMON_A
): $(GMON_OFILES
) $(GMON_START
)
447 $(AR
) rcv
$(LIBGMON_A
) $(GMON_OFILES
)
449 $(API_VER
): $(srcdir)/cygwin.din
450 @echo Error
: Version
info is older than DLL API
!
452 version.
cc winver.o
: winver_stamp
455 globals.h
: mkglobals_h globals.
cc
458 ${DLL_OFILES} ${LIBCOS}: globals.h
460 shared_info_magic.h
: cygmagic shared_info.h
461 /bin
/sh
$(word 1,$^
) $@
"${COMPILE.cc} -E -x c++" $(word 2,$^
) SHARED_MAGIC
'class shared_info' USER_MAGIC
'class user_info'
463 child_info_magic.h
: cygmagic child_info.h
464 /bin
/sh
$(word 1,$^
) $@
"${COMPILE.cc} -E -x c++" $(word 2,$^
) CHILD_INFO_MAGIC
'class child_info'
466 dcrt0.o sigproc.o
: child_info_magic.h
468 shared.o
: shared_info_magic.h
470 $(srcdir)/devices.
cc: gendevices devices.in devices.h
471 ${wordlist
1,2,$^
} $@
473 ${CURDIR}/libc.a
: ${LIB_NAME} ${CURDIR}/libm.a libpthread.a libutil.a
476 ${CURDIR}/libm.a
: ${LIB_NAME} $(LIBM
)
479 libpthread.a
: ${LIB_NAME} pthread.o thread.o
482 libutil.a
: ${LIB_NAME} bsdlib.o
485 libdl.a
: ${LIB_NAME} dlfcn.o
488 libresolv.a
: ${LIB_NAME} minires.o
491 librt.a
: ${LIB_NAME} posix_ipc.o
494 ${EXTRALIBS}: lib
%.a
: %.o
497 winver_stamp
: mkvers.sh
include/cygwin
/version.h winver.rc
$(DLL_OFILES
)
498 @echo
"Making version.o and winver.o";\
499 /bin
/sh
${word 1,$^
} ${word 2,$^
} ${word 3,$^
} $(WINDRES
) ${CFLAGS} $(addprefix -I
,${CCWRAP_SYSTEM_HEADERS} ${CCWRAP_DIRAFTER_HEADERS}) S
&& \
500 $(COMPILE.
cc) -c
-o version.o version.
cc && \
503 Makefile
: cygwin.din
${srcdir}/Makefile.in
504 /bin
/sh .
/config.status
506 $(DEF_FILE
): gendef cygwin.din
$(srcdir)/tlsoffsets.h
509 $(srcdir)/tlsoffsets.h
: gentls_offsets cygtls.h
510 $^
$@
$(COMPILE.
cc) -c
514 { rm -f
$(DEF_FILE
); $(MAKE
) -s
-j1
$(DEF_FILE
); }; \
515 [ -s
$@
] && touch
$@
523 -cd
$(srcdir) && ctags
-R
--regex-C
++='/^([a-zA-Z0-9_]*::[a-zA-Z0-9_]*) /\1/f/' .
525 deps
:=${wildcard *.d
}