]> sourceware.org Git - newlib-cygwin.git/blame - winsup/utils/Makefile.in
Cygwin: utils: convert usage() to proper noreturn function throughout
[newlib-cygwin.git] / winsup / utils / Makefile.in
CommitLineData
1fd5e000 1# Makefile for Cygwin utilities
1fd5e000
CF
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
1fd5e000 9srcdir:=@srcdir@
4c36016b
CF
10target_builddir:=@target_builddir@
11winsup_srcdir:=@winsup_srcdir@
12configure_args=@configure_args@
13
14export CC:=@CC@
15export CXX:=@CXX@
16
29413f06
CF
17CFLAGS:=@CFLAGS@
18CXXFLAGS:=@CXXFLAGS@
19override CXXFLAGS+=-fno-exceptions -fno-rtti
20
4c36016b
CF
21include ${srcdir}/../Makefile.common
22
23cygwin_build:=${target_builddir}/winsup/cygwin
24
25cygwin_headers:=@cygwin_headers@
26
27# environment variables used by ccwrap
28export CCWRAP_HEADERS:=. ${srcdir} $(call justdir,${cygwin_headers})
29export CCWRAP_SYSTEM_HEADERS:=${cygwin_headers} @newlib_headers@
30export CCWRAP_DIRAFTER_HEADERS:=@windows_headers@
31
32WINDOWS_LIBDIR:=@windows_libdir@
33
1fd5e000
CF
34prefix:=@prefix@
35exec_prefix:=@exec_prefix@
36
37bindir:=@bindir@
1fd5e000
CF
38program_transform_name:=@program_transform_name@
39
9ddd929f
CF
40override INSTALL:=@INSTALL@
41override INSTALL_PROGRAM:=@INSTALL_PROGRAM@
42override INSTALL_DATA:=@INSTALL_DATA@
1fd5e000
CF
43
44EXEEXT:=@EXEEXT@
45EXEEXT_FOR_BUILD:=@EXEEXT_FOR_BUILD@
46
68d2dd03
BD
47.PHONY: all install clean realclean warn_dumper warn_cygcheck_zlib
48
29413f06 49LDLIBS := -lnetapi32 -ladvapi32 -lkernel32 -luser32
7e38f161 50CYGWIN_LDFLAGS := -static -Wl,--enable-auto-import -L${WINDOWS_LIBDIR} $(LDLIBS)
4c36016b 51DEP_LDLIBS := $(cygwin_build)/libcygwin.a
68d2dd03 52
4c36016b 53MINGW_CXX := @MINGW_CXX@
68d2dd03
BD
54
55# List all binaries to be linked in Cygwin mode. Each binary on this list
56# must have a corresponding .o of the same name.
0d4b39d3 57CYGWIN_BINS := ${addsuffix .exe,chattr cygpath gencat getconf getfacl ldd locale lsattr kill minidumper mkgroup \
e2bf82d3 58 mkpasswd mount passwd pldd ps regtool setfacl setmetamode ssp tzset umount}
68d2dd03
BD
59
60# List all binaries to be linked in MinGW mode. Each binary on this list
61# must have a corresponding .o of the same name.
cea37699 62MINGW_BINS := ${addsuffix .exe,cygcheck cygwin-console-helper ldh strace}
68d2dd03
BD
63
64# List all objects to be compiled in MinGW mode. Any object not on this
65# list will will be compiled in Cygwin mode implicitly, so there is no
66# need for a CYGWIN_OBJS.
f96f7bec 67MINGW_OBJS := bloda.o cygcheck.o cygwin-console-helper.o dump_setup.o ldh.o path.o strace.o
7df2c73d 68MINGW_LDFLAGS:=-static
4c36016b
CF
69
70CYGCHECK_OBJS:=cygcheck.o bloda.o path.o dump_setup.o
7e38f161 71ZLIB:=-lz
4c36016b
CF
72
73.PHONY: all
74all:
68d2dd03
BD
75
76# If a binary should link in any objects besides the .o with the same
77# name as the binary, then list those here.
78strace.exe: path.o
4c36016b 79cygcheck.exe: cygcheck.o bloda.o path.o dump_setup.o
68d2dd03 80
1e497ebd 81path-mount.o: path.cc
4c36016b 82 ${COMPILE.cc} -c -DFSTAB_ONLY -o $@ $<
1e497ebd
CV
83mount.exe: path-mount.o
84
4c2380d3
CV
85.PHONY: tzmap
86tzmap:
87 ${srcdir}/tzmap-from-unicode.org > ${srcdir}/$@.h
88
89tzmap.h:
90 [ -f "${srcdir}/tzmap.h" ] || ${srcdir}/tzmap-from-unicode.org > ${srcdir}/$@
91
92tzset.o: tzmap.h
93
68d2dd03 94# Provide any necessary per-target variable overrides.
4c36016b 95
700a3783 96cygcheck.exe: MINGW_LDFLAGS += ${ZLIB} -lwininet -lpsapi -lntdll
4c36016b
CF
97cygcheck.exe: ${CYGCHECK_OBJS}
98
99cygpath.o: CXXFLAGS += -fno-threadsafe-statics
649619b5
CV
100cygpath.exe: CYGWIN_LDFLAGS += -lcygwin -luserenv -lntdll
101ps.exe: CYGWIN_LDFLAGS += -lcygwin -lpsapi -lntdll
02a7f96e 102strace.exe: MINGW_LDFLAGS += -lntdll
68d2dd03 103
e3ca53d9 104ldd.exe:CYGWIN_LDFLAGS += -lpsapi -lntdll
4c36016b 105pldd.exe: CYGWIN_LDFLAGS += -lpsapi
8f8e7757 106minidumper.exe: CYGWIN_LDFLAGS += -ldbghelp
086dc27f 107
4c36016b 108ldh.exe: MINGW_LDFLAGS += -nostdlib -lkernel32
2e13058e 109
68d2dd03 110# Check for dumper's requirements and enable it if found.
4c36016b
CF
111libbfd := $(call libname,libbfd.a)
112build_dumper := $(shell test -r "$(libbfd)" && echo 1)
113
68d2dd03
BD
114ifdef build_dumper
115CYGWIN_BINS += dumper.exe
0302c691
JT
116dumper.o module_info.o: CXXFLAGS += -I$(top_srcdir)/include
117dumper.o: dumper.h
118dumper.exe: module_info.o
b245014a 119dumper.exe: CYGWIN_LDFLAGS += -lpsapi -lbfd -lintl -liconv -liberty ${ZLIB} -lntdll
2fac517d 120else
68d2dd03 121all: warn_dumper
2fac517d
CF
122endif
123
68d2dd03 124all: Makefile $(CYGWIN_BINS) $(MINGW_BINS)
0ad10c0f 125
59fb00ae
BD
126# test harness support (note: the "MINGW_BINS +=" should come after the
127# "all:" above so that the testsuite is not run for "make" but only
128# "make check".)
129MINGW_BINS += testsuite.exe
130MINGW_OBJS += path-testsuite.o testsuite.o
131testsuite.exe: path-testsuite.o
132path-testsuite.cc: path.cc ; @test -L $@ || ln -sf ${filter %.cc,$^} $@
133path-testsuite.o: MINGW_CXXFLAGS += -DTESTSUITE
134# this is necessary because this .c lives in the build dir instead of src
135path-testsuite.o: MINGW_CXX := ${patsubst -I.,-I$(utils_source),$(MINGW_CXX)}
136path-testsuite.cc path.cc testsuite.cc: testsuite.h
137check: testsuite.exe ; $(<D)/$(<F)
138
139# the rest of this file contains generic rules
140
68d2dd03 141# how to compile a MinGW object
4c36016b
CF
142${MINGW_OBJS}: override CXX:=${MINGW_CXX}
143${MINGW_OBJS}: CCWRAP_HEADERS:=${srcdir}
144${MINGW_OBJS}: CCWRAP_SYSTEM_HEADERS:=
145# ${MINGW_OBJS}: CCWRAP_DIRAFTER_HEADERS:=
68d2dd03 146$(MINGW_OBJS): %.o: %.cc
4c36016b 147 c++wrap -c -o $@ ${CXXFLAGS} $(MINGW_CXXFLAGS) $<
d0d51791 148
68d2dd03
BD
149# how to link a MinGW binary
150$(MINGW_BINS): %.exe: %.o
5b31f27f 151 $(MINGW_CXX) $(MINGW_CXXFLAGS) -o $@ ${filter %.o,$^} $(MINGW_LDFLAGS)
64b94981 152
68d2dd03 153# how to link a Cygwin binary
9401a0f8 154$(CYGWIN_BINS): %.exe: %.o
4c36016b 155 ${CXX} -o $@ $(filter %.o,$^) -B${cygwin_build}/ ${LDFLAGS} ${CYGWIN_LDFLAGS}
ad466e2f 156
68d2dd03 157# note: how to compile a Cygwin object is covered by the pattern rule in Makefile.common
ad466e2f 158
68d2dd03 159# these dependencies ensure that the required in-tree libs are built first
4c36016b
CF
160$(MINGW_BINS): $(DEP_LDLIBS)
161$(CYGWIN_BINS): $(DEP_LDLIBS)
c49fa762 162
29413f06
CF
163cygcheck.o cygpath.o module_info.o path.o ps.o regtool.o strace.o: loadlib.h
164
4c36016b 165.PHONY: clean
1fd5e000 166clean:
59fb00ae 167 rm -f *.o $(CYGWIN_BINS) $(MINGW_BINS) path-testsuite.cc testsuite.exe
1fd5e000 168
4c36016b 169.PHONY: realclean
1fd5e000 170realclean: clean
68d2dd03 171 rm -f Makefile config.cache
1fd5e000 172
4c36016b 173.PHONY: install
1fd5e000 174install: all
4c36016b 175 /bin/mkdir -p ${DESTDIR}${bindir}
92108f4e 176 for i in $(CYGWIN_BINS) ${filter-out testsuite.exe,$(MINGW_BINS)} ; do \
1fd5e000 177 n=`echo $$i | sed '$(program_transform_name)'`; \
99fe2b78 178 $(INSTALL_PROGRAM) $$i $(DESTDIR)$(bindir)/$$n; \
1fd5e000
CF
179 done
180
181$(cygwin_build)/libcygwin.a: $(cygwin_build)/Makefile
182 @$(MAKE) -C $(@D) $(@F)
183
4c36016b 184.PHONY: warn_dumper
0715614b 185warn_dumper:
8f8977bb
CF
186 @echo '*** Not building dumper.exe since some required libraries or'
187 @echo '*** or headers are missing. Potential candidates are:'
188 @echo '*** bfd.h, libbfd.a, libiconv.a, or libintl.a'
10e1fce6 189 @echo '*** If you need this program, check out the naked-bfd and naked-intl'
e3e942ac 190 @echo '*** sources from sourceware.org. Then, configure and build these'
10e1fce6 191 @echo '*** libraries. Otherwise, you can safely ignore this warning.'
0715614b 192
4c36016b
CF
193Makefile: Makefile.in config.status
194 /bin/sh ./config.status
This page took 0.329007 seconds and 5 git commands to generate.