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