]> sourceware.org Git - newlib-cygwin.git/blame - winsup/utils/Makefile.in
* Makefile.in (ZLIBS): Common define to force static load.
[newlib-cygwin.git] / winsup / utils / Makefile.in
CommitLineData
1fd5e000 1# Makefile for Cygwin utilities
4d7c0b51 2# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
be822de2 3# 2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc.
1fd5e000
CF
4
5# This file is part of Cygwin.
6
7# This software is a copyrighted work licensed under the terms of the
8# Cygwin license. Please consult the file "CYGWIN_LICENSE" for
9# details.
10
1fd5e000 11srcdir:=@srcdir@
4c36016b
CF
12target_builddir:=@target_builddir@
13winsup_srcdir:=@winsup_srcdir@
14configure_args=@configure_args@
15
16export CC:=@CC@
17export CXX:=@CXX@
18
19include ${srcdir}/../Makefile.common
20
21cygwin_build:=${target_builddir}/winsup/cygwin
22
23cygwin_headers:=@cygwin_headers@
24
25# environment variables used by ccwrap
26export CCWRAP_HEADERS:=. ${srcdir} $(call justdir,${cygwin_headers})
27export CCWRAP_SYSTEM_HEADERS:=${cygwin_headers} @newlib_headers@
28export CCWRAP_DIRAFTER_HEADERS:=@windows_headers@
29
30WINDOWS_LIBDIR:=@windows_libdir@
31
1fd5e000
CF
32prefix:=@prefix@
33exec_prefix:=@exec_prefix@
34
35bindir:=@bindir@
1fd5e000
CF
36program_transform_name:=@program_transform_name@
37
9ddd929f
CF
38override INSTALL:=@INSTALL@
39override INSTALL_PROGRAM:=@INSTALL_PROGRAM@
40override INSTALL_DATA:=@INSTALL_DATA@
1fd5e000
CF
41
42EXEEXT:=@EXEEXT@
43EXEEXT_FOR_BUILD:=@EXEEXT_FOR_BUILD@
44
1fd5e000 45CFLAGS:=@CFLAGS@
2c2473bc 46CXXFLAGS:=@CXXFLAGS@
67763c0c 47override CXXFLAGS+=-fno-exceptions -fno-rtti -DHAVE_DECL_GETOPT=0
1fd5e000 48
68d2dd03
BD
49.PHONY: all install clean realclean warn_dumper warn_cygcheck_zlib
50
4c36016b
CF
51LDLIBS := -lnetapi32 -ladvapi32 -lkernel32 -luser32
52CYGWIN_LDFLAGS := -static-libgcc -Wl,--enable-auto-import -L${WINDOWS_LIBDIR} $(LDLIBS)
53DEP_LDLIBS := $(cygwin_build)/libcygwin.a
68d2dd03 54
4c36016b 55MINGW_CXX := @MINGW_CXX@
68d2dd03
BD
56
57# List all binaries to be linked in Cygwin mode. Each binary on this list
58# must have a corresponding .o of the same name.
c769bdf5 59CYGWIN_BINS := ${addsuffix .exe,cygpath getconf getfacl ldd locale kill mkgroup \
e2bf82d3 60 mkpasswd mount passwd pldd ps regtool setfacl setmetamode ssp tzset umount}
68d2dd03
BD
61
62# List all binaries to be linked in MinGW mode. Each binary on this list
63# must have a corresponding .o of the same name.
cea37699 64MINGW_BINS := ${addsuffix .exe,cygcheck cygwin-console-helper ldh strace}
68d2dd03
BD
65
66# List all objects to be compiled in MinGW mode. Any object not on this
67# list will will be compiled in Cygwin mode implicitly, so there is no
68# need for a CYGWIN_OBJS.
2e13058e 69MINGW_OBJS := bloda.o cygcheck.o dump_setup.o ldh.o path.o strace.o
66444a6b 70MINGW_LDFLAGS:=-L${WINDOWS_LIBDIR} -static-libgcc
4c36016b
CF
71
72CYGCHECK_OBJS:=cygcheck.o bloda.o path.o dump_setup.o
66444a6b 73ZLIB:=-Wl,-dn,-lz,-dy
4c36016b
CF
74
75.PHONY: all
76all:
68d2dd03
BD
77
78# If a binary should link in any objects besides the .o with the same
79# name as the binary, then list those here.
80strace.exe: path.o
4c36016b 81cygcheck.exe: cygcheck.o bloda.o path.o dump_setup.o
68d2dd03 82
1e497ebd 83path-mount.o: path.cc
4c36016b 84 ${COMPILE.cc} -c -DFSTAB_ONLY -o $@ $<
1e497ebd
CV
85mount.exe: path-mount.o
86
68d2dd03 87# Provide any necessary per-target variable overrides.
4c36016b 88
66444a6b 89cygcheck.exe: MINGW_LDFLAGS += ${ZLIB} -lpsapi -lntdll
4c36016b
CF
90cygcheck.exe: ${CYGCHECK_OBJS}
91
92cygpath.o: CXXFLAGS += -fno-threadsafe-statics
93cygpath.exe: CYGWIN_LDFLAGS += -luserenv -lntdll
94ps.exe: CYGWIN_LDFLAGS += -lpsapi -lntdll
02a7f96e 95strace.exe: MINGW_LDFLAGS += -lntdll
68d2dd03 96
4c36016b
CF
97ldd.exe:CYGWIN_LDFLAGS += -lpsapi
98pldd.exe: CYGWIN_LDFLAGS += -lpsapi
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
4c36016b 108dumper.o module_info.o parse_pe.o: CXXFLAGS += -I$(top_srcdir)/include
68d2dd03
BD
109dumper.o parse_pe.o: dumper.h
110dumper.exe: module_info.o parse_pe.o
66444a6b 111dumper.exe: CYGWIN_LDFLAGS += -lbfd -lintl -liconv -liberty ${ZLIB}
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 133# how to compile a MinGW object
4c36016b
CF
134${MINGW_OBJS}: override CXX:=${MINGW_CXX}
135${MINGW_OBJS}: CCWRAP_HEADERS:=${srcdir}
136${MINGW_OBJS}: CCWRAP_SYSTEM_HEADERS:=
137# ${MINGW_OBJS}: CCWRAP_DIRAFTER_HEADERS:=
68d2dd03 138$(MINGW_OBJS): %.o: %.cc
4c36016b 139 c++wrap -c -o $@ ${CXXFLAGS} $(MINGW_CXXFLAGS) $<
d0d51791 140
68d2dd03
BD
141# how to link a MinGW binary
142$(MINGW_BINS): %.exe: %.o
5b31f27f 143 $(MINGW_CXX) $(MINGW_CXXFLAGS) -o $@ ${filter %.o,$^} $(MINGW_LDFLAGS)
64b94981 144
68d2dd03 145# how to link a Cygwin binary
9401a0f8 146$(CYGWIN_BINS): %.exe: %.o
4c36016b 147 ${CXX} -o $@ $(filter %.o,$^) -B${cygwin_build}/ ${LDFLAGS} ${CYGWIN_LDFLAGS}
ad466e2f 148
68d2dd03 149# note: how to compile a Cygwin object is covered by the pattern rule in Makefile.common
ad466e2f 150
68d2dd03 151# these dependencies ensure that the required in-tree libs are built first
4c36016b
CF
152$(MINGW_BINS): $(DEP_LDLIBS)
153$(CYGWIN_BINS): $(DEP_LDLIBS)
c49fa762 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 \
1fd5e000 167 n=`echo $$i | sed '$(program_transform_name)'`; \
99fe2b78 168 $(INSTALL_PROGRAM) $$i $(DESTDIR)$(bindir)/$$n; \
1fd5e000
CF
169 done
170
171$(cygwin_build)/libcygwin.a: $(cygwin_build)/Makefile
172 @$(MAKE) -C $(@D) $(@F)
173
4c36016b 174.PHONY: warn_dumper
0715614b 175warn_dumper:
8f8977bb
CF
176 @echo '*** Not building dumper.exe since some required libraries or'
177 @echo '*** or headers are missing. Potential candidates are:'
178 @echo '*** bfd.h, libbfd.a, libiconv.a, or libintl.a'
10e1fce6 179 @echo '*** If you need this program, check out the naked-bfd and naked-intl'
e3e942ac 180 @echo '*** sources from sourceware.org. Then, configure and build these'
10e1fce6 181 @echo '*** libraries. Otherwise, you can safely ignore this warning.'
0715614b 182
4c36016b
CF
183Makefile: Makefile.in config.status
184 /bin/sh ./config.status
This page took 0.262031 seconds and 5 git commands to generate.