]> sourceware.org Git - newlib-cygwin.git/blob - winsup/utils/Makefile.in
Cygwin: add 3.2.1 release file and add fixes up to this point
[newlib-cygwin.git] / winsup / utils / Makefile.in
1 # Makefile for Cygwin utilities
2
3 # This file is part of Cygwin.
4
5 # This software is a copyrighted work licensed under the terms of the
6 # Cygwin license. Please consult the file "CYGWIN_LICENSE" for
7 # details.
8
9 srcdir:=@srcdir@
10 target_builddir:=@target_builddir@
11 winsup_srcdir:=@winsup_srcdir@
12
13 CC:=@CC@
14 CXX:=@CXX@
15
16 CFLAGS_COMMON=-Wimplicit-fallthrough=4 -Werror
17 CFLAGS:=@CFLAGS@
18 CXXFLAGS:=@CXXFLAGS@
19 INCLUDES:=@INCLUDES@
20 override CFLAGS+=${CFLAGS_COMMON}
21 override CXXFLAGS+=${CFLAGS_COMMON}
22
23 include ${srcdir}/../Makefile.common
24
25 cygwin_build:=${target_builddir}/winsup/cygwin
26
27 prefix:=@prefix@
28 exec_prefix:=@exec_prefix@
29
30 bindir:=@bindir@
31
32 override INSTALL:=@INSTALL@
33 override INSTALL_PROGRAM:=@INSTALL_PROGRAM@
34 override INSTALL_DATA:=@INSTALL_DATA@
35
36 EXEEXT:=@EXEEXT@
37 EXEEXT_FOR_BUILD:=@EXEEXT_FOR_BUILD@
38
39 .PHONY: all install clean realclean warn_dumper warn_cygcheck_zlib
40
41 LDLIBS := -lnetapi32 -ladvapi32 -lkernel32 -luser32
42 CYGWIN_LDFLAGS := -static -Wl,--enable-auto-import $(LDLIBS)
43 DEP_LDLIBS := $(cygwin_build)/libcygwin.a
44
45 MINGW_CXX := @MINGW_CXX@
46
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}
51
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.
54 ifdef MINGW_CXX
55 MINGW_BINS := ${addsuffix .exe,cygcheck cygwin-console-helper ldh strace}
56 endif
57
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
63
64 CYGCHECK_OBJS:=cygcheck.o bloda.o path.o dump_setup.o
65 ZLIB:=-lz
66
67 .PHONY: all
68 all:
69
70 # If a binary should link in any objects besides the .o with the same
71 # name as the binary, then list those here.
72 strace.exe: path.o
73 cygcheck.exe: cygcheck.o bloda.o path.o dump_setup.o
74
75 path-mount.o: path.cc
76 ${COMPILE.cc} -c -DFSTAB_ONLY -o $@ $<
77 mount.exe: path-mount.o
78
79 .PHONY: tzmap
80 tzmap:
81 ${srcdir}/tzmap-from-unicode.org > ${srcdir}/$@.h
82
83 tzmap.h:
84 [ -f "${srcdir}/tzmap.h" ] || ${srcdir}/tzmap-from-unicode.org > ${srcdir}/$@
85
86 tzset.o: tzmap.h
87
88 # Provide any necessary per-target variable overrides.
89
90 cygcheck.exe: MINGW_LDFLAGS += ${ZLIB} -lwininet -lpsapi -lntdll
91 cygcheck.exe: ${CYGCHECK_OBJS}
92
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
97
98 ldd.exe:CYGWIN_LDFLAGS += -lpsapi -lntdll
99 pldd.exe: CYGWIN_LDFLAGS += -lpsapi
100 minidumper.exe: CYGWIN_LDFLAGS += -ldbghelp
101
102 ldh.exe: MINGW_LDFLAGS += -nostdlib -lkernel32
103
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)
107
108 ifdef build_dumper
109 CYGWIN_BINS += dumper.exe
110 dumper.o module_info.o: CXXFLAGS += -I$(top_srcdir)/include
111 dumper.o: dumper.h
112 dumper.exe: module_info.o
113 dumper.exe: CYGWIN_LDFLAGS += -lpsapi -lbfd -lintl -liconv -liberty ${ZLIB} -lntdll
114 else
115 all: warn_dumper
116 endif
117
118 all: Makefile $(CYGWIN_BINS) $(MINGW_BINS)
119
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
122 # "make check".)
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)
132
133 # the rest of this file contains generic rules
134
135 # how to compile a MinGW object
136 $(MINGW_OBJS): %.o: %.cc
137 ${MINGW_CXX} -c -o $@ ${CXXFLAGS} $(MINGW_CXXFLAGS) $<
138
139 # how to link a MinGW binary
140 $(MINGW_BINS): %.exe: %.o
141 $(MINGW_CXX) $(MINGW_CXXFLAGS) -o $@ ${filter %.o,$^} $(MINGW_LDFLAGS)
142
143 # how to link a Cygwin binary
144 $(CYGWIN_BINS): %.exe: %.o
145 ${CXX} -o $@ $(filter %.o,$^) -B${cygwin_build}/ ${LDFLAGS} ${CYGWIN_LDFLAGS}
146
147 # note: how to compile a Cygwin object is covered by the pattern rule in Makefile.common
148
149 # these dependencies ensure that the required in-tree libs are built first
150 $(MINGW_BINS): $(DEP_LDLIBS)
151 $(CYGWIN_BINS): $(DEP_LDLIBS)
152
153 cygcheck.o cygpath.o module_info.o path.o ps.o regtool.o strace.o: loadlib.h
154
155 .PHONY: clean
156 clean:
157 rm -f *.o $(CYGWIN_BINS) $(MINGW_BINS) path-testsuite.cc testsuite.exe
158
159 .PHONY: realclean
160 realclean: clean
161 rm -f Makefile config.cache
162
163 .PHONY: install
164 install: all
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; \
168 done
169
170 .PHONY: warn_dumper
171 warn_dumper:
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.'
This page took 0.043174 seconds and 5 git commands to generate.