]> sourceware.org Git - newlib-cygwin.git/blame - 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
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@
4c36016b 12
7fa743ca
JT
13CC:=@CC@
14CXX:=@CXX@
15
acfed136 16CFLAGS_COMMON=-Wimplicit-fallthrough=4 -Werror
29413f06
CF
17CFLAGS:=@CFLAGS@
18CXXFLAGS:=@CXXFLAGS@
b55e3f19 19INCLUDES:=@INCLUDES@
acfed136 20override CFLAGS+=${CFLAGS_COMMON}
7d5efba7 21override CXXFLAGS+=${CFLAGS_COMMON}
29413f06 22
4c36016b
CF
23include ${srcdir}/../Makefile.common
24
25cygwin_build:=${target_builddir}/winsup/cygwin
26
1fd5e000
CF
27prefix:=@prefix@
28exec_prefix:=@exec_prefix@
29
30bindir:=@bindir@
1fd5e000 31
9ddd929f
CF
32override INSTALL:=@INSTALL@
33override INSTALL_PROGRAM:=@INSTALL_PROGRAM@
34override INSTALL_DATA:=@INSTALL_DATA@
1fd5e000
CF
35
36EXEEXT:=@EXEEXT@
37EXEEXT_FOR_BUILD:=@EXEEXT_FOR_BUILD@
38
68d2dd03
BD
39.PHONY: all install clean realclean warn_dumper warn_cygcheck_zlib
40
29413f06 41LDLIBS := -lnetapi32 -ladvapi32 -lkernel32 -luser32
78bfd7db 42CYGWIN_LDFLAGS := -static -Wl,--enable-auto-import $(LDLIBS)
4c36016b 43DEP_LDLIBS := $(cygwin_build)/libcygwin.a
68d2dd03 44
4c36016b 45MINGW_CXX := @MINGW_CXX@
68d2dd03
BD
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.
0d4b39d3 49CYGWIN_BINS := ${addsuffix .exe,chattr cygpath gencat getconf getfacl ldd locale lsattr kill minidumper mkgroup \
e2bf82d3 50 mkpasswd mount passwd pldd ps regtool setfacl setmetamode ssp tzset umount}
68d2dd03
BD
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.
dc93f7ef 54ifdef MINGW_CXX
cea37699 55MINGW_BINS := ${addsuffix .exe,cygcheck cygwin-console-helper ldh strace}
dc93f7ef 56endif
68d2dd03
BD
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.
f96f7bec 61MINGW_OBJS := bloda.o cygcheck.o cygwin-console-helper.o dump_setup.o ldh.o path.o strace.o
7df2c73d 62MINGW_LDFLAGS:=-static
4c36016b
CF
63
64CYGCHECK_OBJS:=cygcheck.o bloda.o path.o dump_setup.o
7e38f161 65ZLIB:=-lz
4c36016b
CF
66
67.PHONY: all
68all:
68d2dd03
BD
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.
72strace.exe: path.o
4c36016b 73cygcheck.exe: cygcheck.o bloda.o path.o dump_setup.o
68d2dd03 74
1e497ebd 75path-mount.o: path.cc
4c36016b 76 ${COMPILE.cc} -c -DFSTAB_ONLY -o $@ $<
1e497ebd
CV
77mount.exe: path-mount.o
78
4c2380d3
CV
79.PHONY: tzmap
80tzmap:
81 ${srcdir}/tzmap-from-unicode.org > ${srcdir}/$@.h
82
83tzmap.h:
84 [ -f "${srcdir}/tzmap.h" ] || ${srcdir}/tzmap-from-unicode.org > ${srcdir}/$@
85
86tzset.o: tzmap.h
87
68d2dd03 88# Provide any necessary per-target variable overrides.
4c36016b 89
700a3783 90cygcheck.exe: MINGW_LDFLAGS += ${ZLIB} -lwininet -lpsapi -lntdll
4c36016b
CF
91cygcheck.exe: ${CYGCHECK_OBJS}
92
93cygpath.o: CXXFLAGS += -fno-threadsafe-statics
649619b5
CV
94cygpath.exe: CYGWIN_LDFLAGS += -lcygwin -luserenv -lntdll
95ps.exe: CYGWIN_LDFLAGS += -lcygwin -lpsapi -lntdll
02a7f96e 96strace.exe: MINGW_LDFLAGS += -lntdll
68d2dd03 97
e3ca53d9 98ldd.exe:CYGWIN_LDFLAGS += -lpsapi -lntdll
4c36016b 99pldd.exe: CYGWIN_LDFLAGS += -lpsapi
8f8e7757 100minidumper.exe: CYGWIN_LDFLAGS += -ldbghelp
086dc27f 101
4c36016b 102ldh.exe: MINGW_LDFLAGS += -nostdlib -lkernel32
2e13058e 103
68d2dd03 104# Check for dumper's requirements and enable it if found.
4c36016b
CF
105libbfd := $(call libname,libbfd.a)
106build_dumper := $(shell test -r "$(libbfd)" && echo 1)
107
68d2dd03
BD
108ifdef build_dumper
109CYGWIN_BINS += dumper.exe
0302c691
JT
110dumper.o module_info.o: CXXFLAGS += -I$(top_srcdir)/include
111dumper.o: dumper.h
112dumper.exe: module_info.o
b245014a 113dumper.exe: CYGWIN_LDFLAGS += -lpsapi -lbfd -lintl -liconv -liberty ${ZLIB} -lntdll
2fac517d 114else
68d2dd03 115all: warn_dumper
2fac517d
CF
116endif
117
68d2dd03 118all: Makefile $(CYGWIN_BINS) $(MINGW_BINS)
0ad10c0f 119
59fb00ae
BD
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".)
123MINGW_BINS += testsuite.exe
124MINGW_OBJS += path-testsuite.o testsuite.o
125testsuite.exe: path-testsuite.o
126path-testsuite.cc: path.cc ; @test -L $@ || ln -sf ${filter %.cc,$^} $@
604bb712 127path-testsuite.o: MINGW_CXXFLAGS += -DTESTSUITE
59fb00ae 128# this is necessary because this .c lives in the build dir instead of src
cbf8fe6d 129path-testsuite.o: MINGW_CXXFLAGS += -I$(srcdir)
59fb00ae
BD
130path-testsuite.cc path.cc testsuite.cc: testsuite.h
131check: testsuite.exe ; $(<D)/$(<F)
132
133# the rest of this file contains generic rules
134
68d2dd03
BD
135# how to compile a MinGW object
136$(MINGW_OBJS): %.o: %.cc
5601d536 137 ${MINGW_CXX} -c -o $@ ${CXXFLAGS} $(MINGW_CXXFLAGS) $<
d0d51791 138
68d2dd03
BD
139# how to link a MinGW binary
140$(MINGW_BINS): %.exe: %.o
5b31f27f 141 $(MINGW_CXX) $(MINGW_CXXFLAGS) -o $@ ${filter %.o,$^} $(MINGW_LDFLAGS)
64b94981 142
68d2dd03 143# how to link a Cygwin binary
9401a0f8 144$(CYGWIN_BINS): %.exe: %.o
4c36016b 145 ${CXX} -o $@ $(filter %.o,$^) -B${cygwin_build}/ ${LDFLAGS} ${CYGWIN_LDFLAGS}
ad466e2f 146
68d2dd03 147# note: how to compile a Cygwin object is covered by the pattern rule in Makefile.common
ad466e2f 148
68d2dd03 149# these dependencies ensure that the required in-tree libs are built first
4c36016b
CF
150$(MINGW_BINS): $(DEP_LDLIBS)
151$(CYGWIN_BINS): $(DEP_LDLIBS)
c49fa762 152
29413f06
CF
153cygcheck.o cygpath.o module_info.o path.o ps.o regtool.o strace.o: loadlib.h
154
4c36016b 155.PHONY: clean
1fd5e000 156clean:
59fb00ae 157 rm -f *.o $(CYGWIN_BINS) $(MINGW_BINS) path-testsuite.cc testsuite.exe
1fd5e000 158
4c36016b 159.PHONY: realclean
1fd5e000 160realclean: clean
68d2dd03 161 rm -f Makefile config.cache
1fd5e000 162
4c36016b 163.PHONY: install
1fd5e000 164install: all
4c36016b 165 /bin/mkdir -p ${DESTDIR}${bindir}
92108f4e 166 for i in $(CYGWIN_BINS) ${filter-out testsuite.exe,$(MINGW_BINS)} ; do \
177d1568 167 $(INSTALL_PROGRAM) $$i $(DESTDIR)$(bindir)/$$i; \
1fd5e000
CF
168 done
169
4c36016b 170.PHONY: warn_dumper
0715614b 171warn_dumper:
8f8977bb
CF
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'
10e1fce6 175 @echo '*** If you need this program, check out the naked-bfd and naked-intl'
e3e942ac 176 @echo '*** sources from sourceware.org. Then, configure and build these'
10e1fce6 177 @echo '*** libraries. Otherwise, you can safely ignore this warning.'
This page took 0.324103 seconds and 5 git commands to generate.