1 # Makefile for Cygwin utilities
3 # This file is part of Cygwin.
5 # This software is a copyrighted work licensed under the terms of the
6 # Cygwin license. Please consult the file "CYGWIN_LICENSE" for
10 target_builddir
:=@target_builddir@
11 winsup_srcdir
:=@winsup_srcdir@
16 CFLAGS_COMMON
=-Wimplicit-fallthrough
=4 -Werror
20 override CFLAGS
+=${CFLAGS_COMMON}
21 override CXXFLAGS
+=${CFLAGS_COMMON}
23 include ${srcdir}/..
/Makefile.common
25 cygwin_build
:=${target_builddir}/winsup
/cygwin
28 exec_prefix:=@
exec_prefix@
32 override INSTALL
:=@INSTALL@
33 override INSTALL_PROGRAM
:=@INSTALL_PROGRAM@
34 override INSTALL_DATA
:=@INSTALL_DATA@
37 EXEEXT_FOR_BUILD
:=@EXEEXT_FOR_BUILD@
39 .PHONY
: all install clean realclean warn_dumper warn_cygcheck_zlib
41 LDLIBS
:= -lnetapi32
-ladvapi32
-lkernel32
-luser32
42 CYGWIN_LDFLAGS
:= -static
-Wl
,--enable-auto-import
$(LDLIBS
)
43 DEP_LDLIBS
:= $(cygwin_build
)/libcygwin.a
45 MINGW_CXX
:= @MINGW_CXX@
47 # List all binaries to be linked in Cygwin mode. Each binary on this list
48 # must have a corresponding .o of the same name.
49 CYGWIN_BINS
:= ${addsuffix .exe
,chattr cygpath gencat getconf getfacl ldd locale lsattr kill minidumper mkgroup \
50 mkpasswd mount passwd pldd ps regtool setfacl setmetamode ssp tzset umount
}
52 # List all binaries to be linked in MinGW mode. Each binary on this list
53 # must have a corresponding .o of the same name.
55 MINGW_BINS
:= ${addsuffix .exe
,cygcheck cygwin-console-helper ldh strace
}
58 # List all objects to be compiled in MinGW mode. Any object not on this
59 # list will will be compiled in Cygwin mode implicitly, so there is no
60 # need for a CYGWIN_OBJS.
61 MINGW_OBJS
:= bloda.o cygcheck.o cygwin-console-helper.o dump_setup.o ldh.o path.o strace.o
62 MINGW_LDFLAGS
:=-static
64 CYGCHECK_OBJS
:=cygcheck.o bloda.o path.o dump_setup.o
70 # If a binary should link in any objects besides the .o with the same
71 # name as the binary, then list those here.
73 cygcheck.exe
: cygcheck.o bloda.o path.o dump_setup.o
76 ${COMPILE.
cc} -c
-DFSTAB_ONLY
-o
$@
$<
77 mount.exe
: path-mount.o
81 ${srcdir}/tzmap-from-unicode.org
> ${srcdir}/$@.h
84 [ -f
"${srcdir}/tzmap.h" ] ||
${srcdir}/tzmap-from-unicode.org
> ${srcdir}/$@
88 # Provide any necessary per-target variable overrides.
90 cygcheck.exe
: MINGW_LDFLAGS
+= ${ZLIB} -lwininet
-lpsapi
-lntdll
91 cygcheck.exe
: ${CYGCHECK_OBJS}
93 cygpath.o
: CXXFLAGS
+= -fno-threadsafe-statics
94 cygpath.exe
: CYGWIN_LDFLAGS
+= -lcygwin
-luserenv
-lntdll
95 ps.exe
: CYGWIN_LDFLAGS
+= -lcygwin
-lpsapi
-lntdll
96 strace.exe
: MINGW_LDFLAGS
+= -lntdll
98 ldd.exe
:CYGWIN_LDFLAGS
+= -lpsapi
-lntdll
99 pldd.exe
: CYGWIN_LDFLAGS
+= -lpsapi
100 minidumper.exe
: CYGWIN_LDFLAGS
+= -ldbghelp
102 ldh.exe
: MINGW_LDFLAGS
+= -nostdlib
-lkernel32
104 # Check for dumper's requirements and enable it if found.
105 libbfd
:= $(call libname
,libbfd.a
)
106 build_dumper
:= $(shell test -r
"$(libbfd)" && echo
1)
109 CYGWIN_BINS
+= dumper.exe
110 dumper.o module_info.o
: CXXFLAGS
+= -I
$(top_srcdir
)/include
112 dumper.exe
: module_info.o
113 dumper.exe
: CYGWIN_LDFLAGS
+= -lpsapi
-lbfd
-lintl
-liconv
-liberty
${ZLIB} -lntdll
118 all: Makefile
$(CYGWIN_BINS
) $(MINGW_BINS
)
120 # test harness support (note: the "MINGW_BINS +=" should come after the
121 # "all:" above so that the testsuite is not run for "make" but only
123 MINGW_BINS
+= testsuite.exe
124 MINGW_OBJS
+= path-testsuite.o testsuite.o
125 testsuite.exe
: path-testsuite.o
126 path-testsuite.
cc: path.
cc ; @
test -L
$@ || ln
-sf
${filter %.
cc,$^
} $@
127 path-testsuite.o
: MINGW_CXXFLAGS
+= -DTESTSUITE
128 # this is necessary because this .c lives in the build dir instead of src
129 path-testsuite.o
: MINGW_CXXFLAGS
+= -I
$(srcdir)
130 path-testsuite.
cc path.
cc testsuite.
cc: testsuite.h
131 check: testsuite.exe
; $(<D
)/$(<F
)
133 # the rest of this file contains generic rules
135 # how to compile a MinGW object
136 $(MINGW_OBJS
): %.o
: %.
cc
137 ${MINGW_CXX} -c
-o
$@
${CXXFLAGS} $(MINGW_CXXFLAGS
) $<
139 # how to link a MinGW binary
140 $(MINGW_BINS
): %.exe
: %.o
141 $(MINGW_CXX
) $(MINGW_CXXFLAGS
) -o
$@
${filter %.o
,$^
} $(MINGW_LDFLAGS
)
143 # how to link a Cygwin binary
144 $(CYGWIN_BINS
): %.exe
: %.o
145 ${CXX} -o
$@
$(filter %.o
,$^
) -B
${cygwin_build}/ ${LDFLAGS} ${CYGWIN_LDFLAGS}
147 # note: how to compile a Cygwin object is covered by the pattern rule in Makefile.common
149 # these dependencies ensure that the required in-tree libs are built first
150 $(MINGW_BINS
): $(DEP_LDLIBS
)
151 $(CYGWIN_BINS
): $(DEP_LDLIBS
)
153 cygcheck.o cygpath.o module_info.o path.o ps.o regtool.o strace.o
: loadlib.h
157 rm -f
*.o
$(CYGWIN_BINS
) $(MINGW_BINS
) path-testsuite.
cc testsuite.exe
161 rm -f Makefile config.cache
165 /bin
/mkdir
-p
${DESTDIR}${bindir}
166 for i in
$(CYGWIN_BINS
) ${filter-out testsuite.exe
,$(MINGW_BINS
)} ; do \
167 $(INSTALL_PROGRAM
) $$i $(DESTDIR
)$(bindir)/$$i; \
172 @echo
'*** Not building dumper.exe since some required libraries or'
173 @echo
'*** or headers are missing. Potential candidates are:'
174 @echo
'*** bfd.h, libbfd.a, libiconv.a, or libintl.a'
175 @echo
'*** If you need this program, check out the naked-bfd and naked-intl'
176 @echo
'*** sources from sourceware.org. Then, configure and build these'
177 @echo
'*** libraries. Otherwise, you can safely ignore this warning.'