2000-02-17 20:38:33 +01:00
|
|
|
# Makefile for Cygwin utilities
|
|
|
|
|
|
|
|
# This file is part of Cygwin.
|
|
|
|
|
|
|
|
# This software is a copyrighted work licensed under the terms of the
|
|
|
|
# Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
# details.
|
|
|
|
|
|
|
|
srcdir:=@srcdir@
|
2012-11-23 14:22:47 +01:00
|
|
|
target_builddir:=@target_builddir@
|
|
|
|
winsup_srcdir:=@winsup_srcdir@
|
|
|
|
configure_args=@configure_args@
|
|
|
|
|
|
|
|
export CC:=@CC@
|
|
|
|
export CXX:=@CXX@
|
|
|
|
|
2012-11-28 04:22:36 +01:00
|
|
|
CFLAGS:=@CFLAGS@
|
|
|
|
CXXFLAGS:=@CXXFLAGS@
|
|
|
|
override CXXFLAGS+=-fno-exceptions -fno-rtti
|
|
|
|
|
2012-11-23 14:22:47 +01:00
|
|
|
include ${srcdir}/../Makefile.common
|
|
|
|
|
|
|
|
cygwin_build:=${target_builddir}/winsup/cygwin
|
|
|
|
|
|
|
|
cygwin_headers:=@cygwin_headers@
|
|
|
|
|
|
|
|
# environment variables used by ccwrap
|
|
|
|
export CCWRAP_HEADERS:=. ${srcdir} $(call justdir,${cygwin_headers})
|
|
|
|
export CCWRAP_SYSTEM_HEADERS:=${cygwin_headers} @newlib_headers@
|
|
|
|
export CCWRAP_DIRAFTER_HEADERS:=@windows_headers@
|
|
|
|
|
|
|
|
WINDOWS_LIBDIR:=@windows_libdir@
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
prefix:=@prefix@
|
|
|
|
exec_prefix:=@exec_prefix@
|
|
|
|
|
|
|
|
bindir:=@bindir@
|
|
|
|
program_transform_name:=@program_transform_name@
|
|
|
|
|
2003-07-26 02:10:48 +02:00
|
|
|
override INSTALL:=@INSTALL@
|
|
|
|
override INSTALL_PROGRAM:=@INSTALL_PROGRAM@
|
|
|
|
override INSTALL_DATA:=@INSTALL_DATA@
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
EXEEXT:=@EXEEXT@
|
|
|
|
EXEEXT_FOR_BUILD:=@EXEEXT_FOR_BUILD@
|
|
|
|
|
2008-03-08 18:52:49 +01:00
|
|
|
.PHONY: all install clean realclean warn_dumper warn_cygcheck_zlib
|
|
|
|
|
2012-11-28 04:22:36 +01:00
|
|
|
LDLIBS := -lnetapi32 -ladvapi32 -lkernel32 -luser32
|
2013-02-21 03:13:17 +01:00
|
|
|
CYGWIN_LDFLAGS := -static -Wl,--enable-auto-import -L${WINDOWS_LIBDIR} $(LDLIBS)
|
2012-11-23 14:22:47 +01:00
|
|
|
DEP_LDLIBS := $(cygwin_build)/libcygwin.a
|
2008-03-08 18:52:49 +01:00
|
|
|
|
2012-11-23 14:22:47 +01:00
|
|
|
MINGW_CXX := @MINGW_CXX@
|
2008-03-08 18:52:49 +01:00
|
|
|
|
|
|
|
# List all binaries to be linked in Cygwin mode. Each binary on this list
|
|
|
|
# must have a corresponding .o of the same name.
|
2018-12-25 23:39:11 +01:00
|
|
|
CYGWIN_BINS := ${addsuffix .exe,chattr cygpath gencat getconf getfacl ldd locale lsattr kill minidumper mkgroup \
|
2012-02-24 11:19:01 +01:00
|
|
|
mkpasswd mount passwd pldd ps regtool setfacl setmetamode ssp tzset umount}
|
2008-03-08 18:52:49 +01:00
|
|
|
|
|
|
|
# List all binaries to be linked in MinGW mode. Each binary on this list
|
|
|
|
# must have a corresponding .o of the same name.
|
2009-07-05 02:01:26 +02:00
|
|
|
MINGW_BINS := ${addsuffix .exe,cygcheck cygwin-console-helper ldh strace}
|
2008-03-08 18:52:49 +01:00
|
|
|
|
|
|
|
# List all objects to be compiled in MinGW mode. Any object not on this
|
|
|
|
# list will will be compiled in Cygwin mode implicitly, so there is no
|
|
|
|
# need for a CYGWIN_OBJS.
|
2009-03-18 05:19:05 +01:00
|
|
|
MINGW_OBJS := bloda.o cygcheck.o dump_setup.o ldh.o path.o strace.o
|
2013-07-31 11:58:55 +02:00
|
|
|
MINGW_LDFLAGS:=-static
|
2012-11-23 14:22:47 +01:00
|
|
|
|
|
|
|
CYGCHECK_OBJS:=cygcheck.o bloda.o path.o dump_setup.o
|
2013-02-21 03:13:17 +01:00
|
|
|
ZLIB:=-lz
|
2012-11-23 14:22:47 +01:00
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all:
|
2008-03-08 18:52:49 +01:00
|
|
|
|
|
|
|
# If a binary should link in any objects besides the .o with the same
|
|
|
|
# name as the binary, then list those here.
|
|
|
|
strace.exe: path.o
|
2012-11-23 14:22:47 +01:00
|
|
|
cygcheck.exe: cygcheck.o bloda.o path.o dump_setup.o
|
2008-03-08 18:52:49 +01:00
|
|
|
|
2009-07-22 12:20:26 +02:00
|
|
|
path-mount.o: path.cc
|
2012-11-23 14:22:47 +01:00
|
|
|
${COMPILE.cc} -c -DFSTAB_ONLY -o $@ $<
|
2009-07-22 12:20:26 +02:00
|
|
|
mount.exe: path-mount.o
|
|
|
|
|
2014-12-05 14:41:52 +01:00
|
|
|
.PHONY: tzmap
|
|
|
|
tzmap:
|
|
|
|
${srcdir}/tzmap-from-unicode.org > ${srcdir}/$@.h
|
|
|
|
|
|
|
|
tzmap.h:
|
|
|
|
[ -f "${srcdir}/tzmap.h" ] || ${srcdir}/tzmap-from-unicode.org > ${srcdir}/$@
|
|
|
|
|
|
|
|
tzset.o: tzmap.h
|
|
|
|
|
2008-03-08 18:52:49 +01:00
|
|
|
# Provide any necessary per-target variable overrides.
|
2012-11-23 14:22:47 +01:00
|
|
|
|
2013-11-19 12:14:36 +01:00
|
|
|
cygcheck.exe: MINGW_LDFLAGS += ${ZLIB} -lwininet -lpsapi -lntdll
|
2012-11-23 14:22:47 +01:00
|
|
|
cygcheck.exe: ${CYGCHECK_OBJS}
|
|
|
|
|
|
|
|
cygpath.o: CXXFLAGS += -fno-threadsafe-statics
|
2013-05-21 11:32:12 +02:00
|
|
|
cygpath.exe: CYGWIN_LDFLAGS += -lcygwin -luserenv -lntdll
|
|
|
|
ps.exe: CYGWIN_LDFLAGS += -lcygwin -lpsapi -lntdll
|
2011-09-15 18:49:51 +02:00
|
|
|
strace.exe: MINGW_LDFLAGS += -lntdll
|
2008-03-08 18:52:49 +01:00
|
|
|
|
2012-11-23 14:22:47 +01:00
|
|
|
ldd.exe:CYGWIN_LDFLAGS += -lpsapi
|
|
|
|
pldd.exe: CYGWIN_LDFLAGS += -lpsapi
|
2014-05-13 12:24:16 +02:00
|
|
|
minidumper.exe: CYGWIN_LDFLAGS += -ldbghelp
|
2009-01-09 06:11:57 +01:00
|
|
|
|
2012-11-23 14:22:47 +01:00
|
|
|
ldh.exe: MINGW_LDFLAGS += -nostdlib -lkernel32
|
2009-03-18 05:19:05 +01:00
|
|
|
|
2008-03-08 18:52:49 +01:00
|
|
|
# Check for dumper's requirements and enable it if found.
|
2012-11-23 14:22:47 +01:00
|
|
|
libbfd := $(call libname,libbfd.a)
|
|
|
|
build_dumper := $(shell test -r "$(libbfd)" && echo 1)
|
|
|
|
|
2008-03-08 18:52:49 +01:00
|
|
|
ifdef build_dumper
|
|
|
|
CYGWIN_BINS += dumper.exe
|
2012-11-23 14:22:47 +01:00
|
|
|
dumper.o module_info.o parse_pe.o: CXXFLAGS += -I$(top_srcdir)/include
|
2008-03-08 18:52:49 +01:00
|
|
|
dumper.o parse_pe.o: dumper.h
|
|
|
|
dumper.exe: module_info.o parse_pe.o
|
2013-11-19 12:14:36 +01:00
|
|
|
dumper.exe: CYGWIN_LDFLAGS += -lpsapi -lbfd -lintl -liconv -liberty ${ZLIB}
|
2001-11-11 04:06:59 +01:00
|
|
|
else
|
2008-03-08 18:52:49 +01:00
|
|
|
all: warn_dumper
|
2001-11-11 04:06:59 +01:00
|
|
|
endif
|
|
|
|
|
2008-03-08 18:52:49 +01:00
|
|
|
all: Makefile $(CYGWIN_BINS) $(MINGW_BINS)
|
2000-08-24 21:03:12 +02:00
|
|
|
|
2008-03-09 05:10:10 +01:00
|
|
|
# test harness support (note: the "MINGW_BINS +=" should come after the
|
|
|
|
# "all:" above so that the testsuite is not run for "make" but only
|
|
|
|
# "make check".)
|
|
|
|
MINGW_BINS += testsuite.exe
|
|
|
|
MINGW_OBJS += path-testsuite.o testsuite.o
|
|
|
|
testsuite.exe: path-testsuite.o
|
|
|
|
path-testsuite.cc: path.cc ; @test -L $@ || ln -sf ${filter %.cc,$^} $@
|
|
|
|
path-testsuite.o: MINGW_CXXFLAGS += -DTESTSUITE
|
|
|
|
# this is necessary because this .c lives in the build dir instead of src
|
|
|
|
path-testsuite.o: MINGW_CXX := ${patsubst -I.,-I$(utils_source),$(MINGW_CXX)}
|
|
|
|
path-testsuite.cc path.cc testsuite.cc: testsuite.h
|
|
|
|
check: testsuite.exe ; $(<D)/$(<F)
|
|
|
|
|
|
|
|
# the rest of this file contains generic rules
|
|
|
|
|
2008-03-08 18:52:49 +01:00
|
|
|
# how to compile a MinGW object
|
2012-11-23 14:22:47 +01:00
|
|
|
${MINGW_OBJS}: override CXX:=${MINGW_CXX}
|
|
|
|
${MINGW_OBJS}: CCWRAP_HEADERS:=${srcdir}
|
|
|
|
${MINGW_OBJS}: CCWRAP_SYSTEM_HEADERS:=
|
|
|
|
# ${MINGW_OBJS}: CCWRAP_DIRAFTER_HEADERS:=
|
2008-03-08 18:52:49 +01:00
|
|
|
$(MINGW_OBJS): %.o: %.cc
|
2012-11-23 14:22:47 +01:00
|
|
|
c++wrap -c -o $@ ${CXXFLAGS} $(MINGW_CXXFLAGS) $<
|
2001-11-11 07:07:36 +01:00
|
|
|
|
2008-03-08 18:52:49 +01:00
|
|
|
# how to link a MinGW binary
|
|
|
|
$(MINGW_BINS): %.exe: %.o
|
2012-11-07 17:32:08 +01:00
|
|
|
$(MINGW_CXX) $(MINGW_CXXFLAGS) -o $@ ${filter %.o,$^} $(MINGW_LDFLAGS)
|
2007-08-03 21:41:48 +02:00
|
|
|
|
2008-03-08 18:52:49 +01:00
|
|
|
# how to link a Cygwin binary
|
2008-10-12 05:08:33 +02:00
|
|
|
$(CYGWIN_BINS): %.exe: %.o
|
2012-11-23 14:22:47 +01:00
|
|
|
${CXX} -o $@ $(filter %.o,$^) -B${cygwin_build}/ ${LDFLAGS} ${CYGWIN_LDFLAGS}
|
2002-01-22 04:17:59 +01:00
|
|
|
|
2008-03-08 18:52:49 +01:00
|
|
|
# note: how to compile a Cygwin object is covered by the pattern rule in Makefile.common
|
2002-01-22 04:17:59 +01:00
|
|
|
|
2008-03-08 18:52:49 +01:00
|
|
|
# these dependencies ensure that the required in-tree libs are built first
|
2012-11-23 14:22:47 +01:00
|
|
|
$(MINGW_BINS): $(DEP_LDLIBS)
|
|
|
|
$(CYGWIN_BINS): $(DEP_LDLIBS)
|
2002-05-13 07:13:58 +02:00
|
|
|
|
2012-11-28 04:22:36 +01:00
|
|
|
cygcheck.o cygpath.o module_info.o path.o ps.o regtool.o strace.o: loadlib.h
|
|
|
|
|
2012-11-23 14:22:47 +01:00
|
|
|
.PHONY: clean
|
2000-02-17 20:38:33 +01:00
|
|
|
clean:
|
2008-03-09 05:10:10 +01:00
|
|
|
rm -f *.o $(CYGWIN_BINS) $(MINGW_BINS) path-testsuite.cc testsuite.exe
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2012-11-23 14:22:47 +01:00
|
|
|
.PHONY: realclean
|
2000-02-17 20:38:33 +01:00
|
|
|
realclean: clean
|
2008-03-08 18:52:49 +01:00
|
|
|
rm -f Makefile config.cache
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2012-11-23 14:22:47 +01:00
|
|
|
.PHONY: install
|
2000-02-17 20:38:33 +01:00
|
|
|
install: all
|
2012-11-23 14:22:47 +01:00
|
|
|
/bin/mkdir -p ${DESTDIR}${bindir}
|
2008-03-09 10:41:42 +01:00
|
|
|
for i in $(CYGWIN_BINS) ${filter-out testsuite.exe,$(MINGW_BINS)} ; do \
|
2000-02-17 20:38:33 +01:00
|
|
|
n=`echo $$i | sed '$(program_transform_name)'`; \
|
2009-02-24 03:11:14 +01:00
|
|
|
$(INSTALL_PROGRAM) $$i $(DESTDIR)$(bindir)/$$n; \
|
2000-02-17 20:38:33 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
$(cygwin_build)/libcygwin.a: $(cygwin_build)/Makefile
|
|
|
|
@$(MAKE) -C $(@D) $(@F)
|
|
|
|
|
2012-11-23 14:22:47 +01:00
|
|
|
.PHONY: warn_dumper
|
2000-08-25 18:50:08 +02:00
|
|
|
warn_dumper:
|
2011-08-21 21:36:52 +02:00
|
|
|
@echo '*** Not building dumper.exe since some required libraries or'
|
|
|
|
@echo '*** or headers are missing. Potential candidates are:'
|
|
|
|
@echo '*** bfd.h, libbfd.a, libiconv.a, or libintl.a'
|
2000-09-10 18:56:00 +02:00
|
|
|
@echo '*** If you need this program, check out the naked-bfd and naked-intl'
|
2008-07-30 08:07:42 +02:00
|
|
|
@echo '*** sources from sourceware.org. Then, configure and build these'
|
2000-09-10 18:56:00 +02:00
|
|
|
@echo '*** libraries. Otherwise, you can safely ignore this warning.'
|
2000-08-25 18:50:08 +02:00
|
|
|
|
2012-11-23 14:22:47 +01:00
|
|
|
Makefile: Makefile.in config.status
|
|
|
|
/bin/sh ./config.status
|