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