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.
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
11 # This makefile requires GNU make.
17 CONFIG_DIR
:=$(srcdir)/config
/@CONFIG_DIR@
18 VPATH
:=$(srcdir):$(CONFIG_DIR
):$(srcdir)/regex
:$(srcdir)/regexp
:$(srcdir)/lib
:$(srcdir)/libc
20 target_alias
:=@target_alias@
21 build_alias
:=@build_alias@
22 host_alias
:=@host_alias@
25 program_transform_name
:=@program_transform_name@
26 exec_prefix:=@
exec_prefix@
30 sysconfdir
:=@sysconfdir@
31 ifeq ($(target_alias
),$(host_alias
))
32 ifeq ($(build_alias
),$(host_alias
))
33 tooldir
:=$(exec_prefix)
35 tooldir
:=$(exec_prefix)/$(target_alias
)
38 tooldir
:=$(exec_prefix)/$(target_alias
)
42 includedir:=@
includedir@
44 override INSTALL
:=@INSTALL@
45 override INSTALL_PROGRAM
:=@INSTALL_PROGRAM@
46 override INSTALL_DATA
:=@INSTALL_DATA@
49 # --enable options from configure
55 # FIXME: Which is it, CC or CC_FOR_TARGET?
58 override CFLAGS
+=-MMD
${$(*F
)_CFLAGS
} -fmerge-constants
-ftracer
$(CCEXTRA
)
60 override CXXFLAGS
=@CXXFLAGS@
74 MKDIRP
:=$(INSTALL
) -m
755 -d
77 # Include common definitions for winsup directory
79 include $(srcdir)/..
/Makefile.common
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`
88 RUNTEST
= `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
89 echo $${srcdir}/../dejagnu/runtest ; \
90 else echo runtest; fi`
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).
99 TEST_DLL_NAME
:=cygwin0.dll
100 TEST_LIB_NAME
:=libcygwin0.a
102 DLL_ENTRY
:=@DLL_ENTRY@
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.
112 LIBCOS
:=${sort ${addsuffix .o
,${basename ${notdir ${wildcard $(srcdir)/lib
/*.c
}}}} \
113 ${addsuffix .o
,${basename ${notdir ${wildcard $(srcdir)/lib
/*.
cc}}}}}
115 # Build all source files in the config directory
117 EXTRA_DLL_OFILES
:=${addsuffix .o
,${basename ${notdir ${wildcard $(CONFIG_DIR
)/*.c
}}}}
121 MALLOC_OFILES
:=@MALLOC_OFILES@
123 DLL_IMPORTS
:=$(w32api_lib
)/libkernel32.a
$(w32api_lib
)/libadvapi32.a
$(w32api_lib
)/libntdll.a
126 # Please maintain this list in sorted order, with maximum files per 86 col line
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
)
151 GMON_OFILES
:=gmon.o mcount.o profil.o
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
164 NEW_FUNCTIONS
:=regcomp posix_regcomp \
165 regerror posix_regerror \
166 regexec posix_regexec \
167 regfree posix_regfree \
170 aclcheck _aclcheck32 \
171 aclfrommode _aclfrommode32 \
172 aclfrompbits _aclfrompbits32 \
173 aclfromtext _aclfromtext32 \
175 acltomode _acltomode32 \
176 acltopbits _acltopbits32 \
177 acltotext _acltotext32 \
190 ftruncate _ftruncate64 \
194 getgrent _getgrent32 \
195 getgrgid _getgrgid32 \
196 getgrnam _getgrnam32 \
197 getgroups _getgroups32 \
198 getpwuid _getpwuid32 \
199 getpwuid_r _getpwuid_r32 \
201 initgroups _initgroups32 \
211 setgroups _setgroups32 \
212 setregid _setregid32 \
213 setreuid _setreuid32 \
220 API_VER
:=$(srcdir)/include/cygwin
/version.h
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
)
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
282 .PHONY
: all force dll_ofiles
install all_target install_target all_host install_host \
283 install install-libs install-headers
286 .SUFFIXES
: .c .
cc .def .a .o .d .s
289 install_host
=@install_host@
291 all: all_target
$(all_host
)
293 all_target
: $(TARGET_LIBS
)
295 all_host
: $(TEST_LIB_NAME
)
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
304 uninstall: uninstall-libs uninstall-headers uninstall-man
306 install-libs
: $(TARGET_LIBS
)
308 $(INSTALL_PROGRAM
) $(TEST_DLL_NAME
) $(bindir)/$(DLL_NAME
); \
310 $(INSTALL_DATA
) $$i $(tooldir
)/lib
/`basename $$i` ; \
312 cd
$(tooldir
)/lib
&& ln
-sf libcygwin.a libg.a
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` ; \
322 $(INSTALL_DATA
) regex
/regex.h
$(tooldir
)/include/regex.h
325 @
$(MKDIRP
) $(mandir)/man2
$(mandir)/man3
$(mandir)/man5
$(mandir)/man7
327 for i in
`find . -type f -name '*.2'`; do \
328 $(INSTALL_DATA
) $$i $(mandir)/man2
/`basename $$i` ; \
330 for i in
`find . -type f -name '*.3'`; do \
331 $(INSTALL_DATA
) $$i $(mandir)/man3
/`basename $$i` ; \
333 for i in
`find . -type f -name '*.5'`; do \
334 $(INSTALL_DATA
) $$i $(mandir)/man5
/`basename $$i` ; \
336 for i in
`find . -type f -name '*.7'`; do \
337 $(INSTALL_DATA
) $$i $(mandir)/man7
/`basename $$i` ; \
344 uninstall-libs
: $(TARGET_LIBS
)
345 rm -f
$(bindir)/$(DLL_NAME
); \
347 rm -f
$(tooldir
)/lib
/$$i ; \
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` ; \
357 rm -f
$(tooldir
)/include/regex.h
361 for i in
`find . -type f -name '*.2'`; do \
362 rm -f
$(tooldir
)/man
/man2
/`basename $$i` ; \
364 for i in
`find . -type f -name '*.3'`; do \
365 rm -f
$(tooldir
)/man
/man3
/`basename $$i` ; \
367 for i in
`find . -type f -name '*.5'`; do \
368 rm -f
$(tooldir
)/man
/man5
/`basename $$i` ; \
370 for i in
`find . -type f -name '*.7'`; do \
371 rm -f
$(tooldir
)/man
/man7
/`basename $$i` ; \
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
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."
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
) \
391 @
$(word 2,$^
) $(OBJDUMP
) $(OBJCOPY
) $@
${patsubst %0.dll
,%1.dbg
,$@
}
392 @ln
-f
$@ new-
$(DLL_NAME
)
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
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' < $?
> $@
407 $(LIBSERVER
): $(bupdir
)/cygserver
/Makefile
408 $(MAKE
) -C
$(bupdir
)/cygserver libcygserver.a
410 dll_ofiles
: $(DLL_OFILES
)
412 $(LIBGMON_A
): $(GMON_OFILES
) $(GMON_START
)
413 $(AR
) rcv
$(LIBGMON_A
) $(GMON_OFILES
)
415 $(API_VER
): $(srcdir)/cygwin.din
416 @echo Error
: Version
info is older than DLL API
!
418 version.
cc winver.o
: winver_stamp
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'
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'
427 dcrt0.o sigproc.o
: child_info_magic.h
429 shared.o
: shared_info_magic.h
431 $(srcdir)/qevices.
cc: cygwin-gperf devices.gperf devices.h
434 $(srcdir)/devices.
cc: gendevices devices.in devices.h
435 ${wordlist
1,2,$^
} $@
437 $(PWD
)/libpthread.a
: speclib
$(LIB_NAME
) pthread.o thread.o
438 /bin
/sh
${word 1, $^
} $@
"${NM}" "$(AR)" ${wordlist
2, 99, $^
}
440 $(PWD
)/libutil.a
: speclib
$(LIB_NAME
) bsdlib.o
441 /bin
/sh
${word 1, $^
} $@
"${NM}" "$(AR)" ${wordlist
2, 99, $^
}
443 $(PWD
)/libm.a
: speclib
$(LIB_NAME
) $(LIBM
)
444 /bin
/sh
${word 1, $^
} $@
"${NM}" "$(AR)" ${wordlist
2, 99, $^
}
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, $^
}
449 $(PWD
)/libdl.a
: speclib
$(LIB_NAME
) dlfcn.o
450 /bin
/sh
${word 1, $^
} $@
"${NM}" "$(AR)" ${wordlist
2, 99, $^
}
452 $(PWD
)/libresolv.a
: speclib
$(LIB_NAME
) minires.o
453 /bin
/sh
${word 1, $^
} $@
"${NM}" "$(AR)" ${wordlist
2, 99, $^
}
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 && \
466 $(DEF_FILE
): gendef cygwin.din
$(srcdir)/tlsoffsets.h
469 $(srcdir)/tlsoffsets.h
: gentls_offsets cygtls.h
474 { rm -f
$(DEF_FILE
); $(MAKE
) -s
-j1
$(DEF_FILE
); }; \
475 [ -s
$@
] && touch
$@
482 deps
:=${wildcard *.d
}