1 # Makefile.in for Cygwin.
2 # Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
4 # This file is part of Cygwin.
6 # This software is a copyrighted work licensed under the terms of the
7 # Cygwin license. Please consult the file "CYGWIN_LICENSE" for
10 # This makefile requires GNU make.
16 CONFIG_DIR
:=$(srcdir)/config
/@CONFIG_DIR@
17 VPATH
:=$(srcdir):$(CONFIG_DIR
):$(srcdir)/regex
:$(srcdir)/regexp
:$(srcdir)/lib
19 target_alias
:=@target_alias@
20 build_alias
:=@build_alias@
21 host_alias
:=@host_alias@
24 program_transform_name
:=@program_transform_name@
25 exec_prefix:=@
exec_prefix@
28 ifeq ($(target_alias
),$(host_alias
))
29 ifeq ($(build_alias
),$(host_alias
))
30 tooldir
:=$(exec_prefix)
32 tooldir
:=$(exec_prefix)/$(target_alias
)
35 tooldir
:=$(exec_prefix)/$(target_alias
)
39 includedir:=@
includedir@
41 override INSTALL
:=@INSTALL@
42 override INSTALL_PROGRAM
:=@INSTALL_PROGRAM@
43 override INSTALL_DATA
:=@INSTALL_DATA@
46 # --enable options from configure
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
82 # FIXME: Which is it, CC or CC_FOR_TARGET?
85 override CFLAGS
+=-MMD
${$(*F
)_CFLAGS
}
100 # Include common definitions for winsup directory
102 include $(srcdir)/..
/Makefile.common
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`
111 RUNTEST
= `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
112 echo $${srcdir}/../dejagnu/runtest ; \
113 else echo runtest; fi`
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).
121 DLL_NAME
:=cygwin1.dll
122 TEST_DLL_NAME
:=cygwin0.dll
123 TEST_LIB_NAME
:=libcygwin0.a
125 DLL_ENTRY
:=@DLL_ENTRY@
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.
135 LIBCOS
:=${sort ${addsuffix .o
,${basename ${notdir ${wildcard $(srcdir)/lib
/*.c
}}}} \
136 ${addsuffix .o
,${basename ${notdir ${wildcard $(srcdir)/lib
/*.
cc}}}}}
138 # Build all source files in the config directory
140 EXTRA_DLL_OFILES
:=${addsuffix .o
,${basename ${notdir ${wildcard $(CONFIG_DIR
)/*.c
}}}}
142 EXTRA_OFILES
=$(bupdir1
)/libiberty
/random.o
$(bupdir1
)/libiberty
/strsignal.o
144 MALLOC_OFILES
=@MALLOC_OFILES@
146 DLL_IMPORTS
:=$(w32api_lib
)/libkernel32.a
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
)
169 GMON_OFILES
:=gmon.o mcount.o profil.o
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 \
182 NEW_FUNCTIONS
:=regcomp posix_regcomp \
183 regerror posix_regerror \
184 regexec posix_regexec \
185 regfree posix_regfree \
188 aclcheck _aclcheck32 \
189 aclfrommode _aclfrommode32 \
190 aclfrompbits _aclfrompbits32 \
191 aclfromtext _aclfromtext32 \
193 acltomode _acltomode32 \
194 acltopbits _acltopbits32 \
195 acltotext _acltotext32 \
207 ftruncate _ftruncate64 \
211 getgrent _getgrent32 \
212 getgrgid _getgrgid32 \
213 getgrnam _getgrnam32 \
214 getgroups _getgroups32 \
215 getpwuid _getpwuid32 \
216 getpwuid_r _getpwuid_r32 \
218 initgroups _initgroups32 \
228 setgroups _setgroups32 \
229 setregid _setregid32 \
230 setreuid _setreuid32 \
236 API_VER
:=$(srcdir)/include/cygwin
/version.h
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
249 .SUFFIXES
: .c .
cc .def .a .o .d .s
252 install_host
=@install_host@
254 all: all_target
$(all_host
)
256 all_target
: $(TARGET_LIBS
)
258 all_host
: $(TEST_LIB_NAME
)
262 install: install-libs install-headers install-man install_target \
263 $(install_host
) $(install_target
)
265 uninstall: uninstall-libs uninstall-headers uninstall-man
267 install-libs
: $(TARGET_LIBS
)
268 $(INSTALL_PROGRAM
) $(TEST_DLL_NAME
) $(bindir)/$(DLL_NAME
); \
270 $(INSTALL_DATA
) $$i $(tooldir
)/lib
/`basename $$i` ; \
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` ; \
280 $(INSTALL_DATA
) regex
/regex.h
$(tooldir
)/include/regex.h
284 for i in
`find . -type f -name '*.2'`; do \
285 $(INSTALL_DATA
) $$i $(tooldir
)/man
/man2
/`basename $$i` ; \
287 for i in
`find . -type f -name '*.3'`; do \
288 $(INSTALL_DATA
) $$i $(tooldir
)/man
/man3
/`basename $$i` ; \
290 for i in
`find . -type f -name '*.5'`; do \
291 $(INSTALL_DATA
) $$i $(tooldir
)/man
/man5
/`basename $$i` ; \
293 for i in
`find . -type f -name '*.7'`; do \
294 $(INSTALL_DATA
) $$i $(tooldir
)/man
/man7
/`basename $$i` ; \
302 uninstall-libs
: $(TARGET_LIBS
)
303 rm -f
$(bindir)/$(DLL_NAME
); \
305 rm -f
$(tooldir
)/lib
/$$i ; \
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` ; \
315 rm -f
$(tooldir
)/include/regex.h
319 for i in
`find . -type f -name '*.2'`; do \
320 rm -f
$(tooldir
)/man
/man2
/`basename $$i` ; \
322 for i in
`find . -type f -name '*.3'`; do \
323 rm -f
$(tooldir
)/man
/man3
/`basename $$i` ; \
325 for i in
`find . -type f -name '*.5'`; do \
326 rm -f
$(tooldir
)/man
/man5
/`basename $$i` ; \
328 for i in
`find . -type f -name '*.7'`; do \
329 rm -f
$(tooldir
)/man
/man7
/`basename $$i` ; \
333 -rm -f
*.o
*.dll
*.a
*.exp junk
*.base version.
cc regexp
/*.o winver_stamp
*.exe
*.d
*stamp
* *_magic.h
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."
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
) \
347 @ln
-f
$@ new-
$(DLL_NAME
)
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
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' < $?
> $@
362 dll_ofiles
: $(DLL_OFILES
)
364 $(LIBGMON_A
): $(GMON_OFILES
) $(GMON_START
)
365 $(AR
) rcv
$(LIBGMON_A
) $(GMON_OFILES
)
367 $(API_VER
): $(srcdir)/cygwin.din
368 @echo Error
: Version
info is older than DLL API
!
371 version.
cc winver.o
: winver_stamp
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'
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'
380 dcrt0.o sigproc.o
: child_info_magic.h
382 shared.o
: shared_info_magic.h
384 $(PWD
)/libpthread.a
: speclib
$(LIB_NAME
) pthread.o thread.o
385 /bin
/sh
${word 1, $^
} $@
"${NM}" "$(AR)" ${wordlist
2, 99, $^
}
387 $(PWD
)/libm.a
: speclib
$(LIB_NAME
) $(LIBM
)
388 /bin
/sh
${word 1, $^
} $@
"${NM}" "$(AR)" ${wordlist
2, 99, $^
}
390 $(PWD
)/libc.a
: speclib
$(LIB_NAME
) $(PWD
)/libm.a libpthread.a
391 /bin
/sh
${word 1, $^
} -v
$@
"${NM}" "$(AR)" ${wordlist
2, 99, $^
}
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 && \
409 $(DEF_FILE
): cygwin.din config.status
410 $(SHELL
) config.status
414 deps
:=${wildcard *.d
}