2000-02-17 19:38:33 +00: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 13:22:47 +00:00
|
|
|
target_builddir:=@target_builddir@
|
|
|
|
winsup_srcdir:=@winsup_srcdir@
|
|
|
|
|
2020-10-27 15:31:06 +00:00
|
|
|
CC:=@CC@
|
|
|
|
CXX:=@CXX@
|
|
|
|
|
2020-08-07 13:31:38 +02:00
|
|
|
CFLAGS_COMMON=-Wimplicit-fallthrough=4 -Werror
|
2012-11-28 03:22:36 +00:00
|
|
|
CFLAGS:=@CFLAGS@
|
|
|
|
CXXFLAGS:=@CXXFLAGS@
|
2020-10-03 14:41:58 +01:00
|
|
|
INCLUDES:=@INCLUDES@
|
2020-08-07 13:31:38 +02:00
|
|
|
override CFLAGS+=${CFLAGS_COMMON}
|
2020-11-11 14:03:58 +00:00
|
|
|
override CXXFLAGS+=${CFLAGS_COMMON}
|
2012-11-28 03:22:36 +00:00
|
|
|
|
2012-11-23 13:22:47 +00:00
|
|
|
include ${srcdir}/../Makefile.common
|
|
|
|
|
|
|
|
cygwin_build:=${target_builddir}/winsup/cygwin
|
|
|
|
|
2000-02-17 19:38:33 +00:00
|
|
|
prefix:=@prefix@
|
|
|
|
exec_prefix:=@exec_prefix@
|
|
|
|
|
|
|
|
bindir:=@bindir@
|
|
|
|
|
2003-07-26 00:10:48 +00:00
|
|
|
override INSTALL:=@INSTALL@
|
|
|
|
override INSTALL_PROGRAM:=@INSTALL_PROGRAM@
|
|
|
|
override INSTALL_DATA:=@INSTALL_DATA@
|
2000-02-17 19:38:33 +00:00
|
|
|
|
|
|
|
EXEEXT:=@EXEEXT@
|
|
|
|
EXEEXT_FOR_BUILD:=@EXEEXT_FOR_BUILD@
|
|
|
|
|
2008-03-08 17:52:49 +00:00
|
|
|
.PHONY: all install clean realclean warn_dumper warn_cygcheck_zlib
|
|
|
|
|
2012-11-28 03:22:36 +00:00
|
|
|
LDLIBS := -lnetapi32 -ladvapi32 -lkernel32 -luser32
|
2020-10-14 16:49:45 +01:00
|
|
|
CYGWIN_LDFLAGS := -static -Wl,--enable-auto-import $(LDLIBS)
|
2012-11-23 13:22:47 +00:00
|
|
|
DEP_LDLIBS := $(cygwin_build)/libcygwin.a
|
2008-03-08 17:52:49 +00:00
|
|
|
|
2012-11-23 13:22:47 +00:00
|
|
|
MINGW_CXX := @MINGW_CXX@
|
2008-03-08 17:52:49 +00: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 10:19:01 +00:00
|
|
|
mkpasswd mount passwd pldd ps regtool setfacl setmetamode ssp tzset umount}
|
2008-03-08 17:52:49 +00:00
|
|
|
|
|
|
|
# List all binaries to be linked in MinGW mode. Each binary on this list
|
|
|
|
# must have a corresponding .o of the same name.
|
Cygwin: Remove recursive configure
There's doesn't seem to be much use in independently distributing these
subdirectories, so allowing them to be independently configured seems
pointless and overcomplicated.
The order in which the subdirectories are built is still a little odd,
as cygwin is linked with libcygserver, and cygserver is then linked with
cygwin. So, we build the cygwin directory first, which invokes a build
of libcygserver in the cygserver directory, and then build in the
cygserver directory to build the cygserver executable.
Drop AC_CONFIGURE_ARGS, since we don't need to recursively call
configure with the same arguments anymore.
Slightly refine when we build utils: Previously we didn't build any
utils if MinGW compiler use was avoided, now we just avoid building
those utils which require that compiler.
Greatly simplify how winsup_srcdir and target_builddir are set, since
we're only configuring from one directory. (These are still kept
absolute, since we don't adjust them where used for being used in a
subdirectory).
Remove configure.cygwin and put it's (greatly reduced) contents inline
in the one place it's used now.
Remove generated configure and aclocal.m4 in subdirectories.
2020-10-06 16:22:02 +01:00
|
|
|
ifdef MINGW_CXX
|
2009-07-05 00:01:26 +00:00
|
|
|
MINGW_BINS := ${addsuffix .exe,cygcheck cygwin-console-helper ldh strace}
|
Cygwin: Remove recursive configure
There's doesn't seem to be much use in independently distributing these
subdirectories, so allowing them to be independently configured seems
pointless and overcomplicated.
The order in which the subdirectories are built is still a little odd,
as cygwin is linked with libcygserver, and cygserver is then linked with
cygwin. So, we build the cygwin directory first, which invokes a build
of libcygserver in the cygserver directory, and then build in the
cygserver directory to build the cygserver executable.
Drop AC_CONFIGURE_ARGS, since we don't need to recursively call
configure with the same arguments anymore.
Slightly refine when we build utils: Previously we didn't build any
utils if MinGW compiler use was avoided, now we just avoid building
those utils which require that compiler.
Greatly simplify how winsup_srcdir and target_builddir are set, since
we're only configuring from one directory. (These are still kept
absolute, since we don't adjust them where used for being used in a
subdirectory).
Remove configure.cygwin and put it's (greatly reduced) contents inline
in the one place it's used now.
Remove generated configure and aclocal.m4 in subdirectories.
2020-10-06 16:22:02 +01:00
|
|
|
endif
|
2008-03-08 17:52:49 +00: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.
|
2019-06-25 00:54:41 -07:00
|
|
|
MINGW_OBJS := bloda.o cygcheck.o cygwin-console-helper.o dump_setup.o ldh.o path.o strace.o
|
2013-07-31 09:58:55 +00:00
|
|
|
MINGW_LDFLAGS:=-static
|
2012-11-23 13:22:47 +00:00
|
|
|
|
|
|
|
CYGCHECK_OBJS:=cygcheck.o bloda.o path.o dump_setup.o
|
2013-02-21 02:13:17 +00:00
|
|
|
ZLIB:=-lz
|
2012-11-23 13:22:47 +00:00
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all:
|
2008-03-08 17:52:49 +00: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 13:22:47 +00:00
|
|
|
cygcheck.exe: cygcheck.o bloda.o path.o dump_setup.o
|
2008-03-08 17:52:49 +00:00
|
|
|
|
2009-07-22 10:20:26 +00:00
|
|
|
path-mount.o: path.cc
|
2012-11-23 13:22:47 +00:00
|
|
|
${COMPILE.cc} -c -DFSTAB_ONLY -o $@ $<
|
2009-07-22 10:20:26 +00:00
|
|
|
mount.exe: path-mount.o
|
|
|
|
|
2014-12-05 13:41:52 +00: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 17:52:49 +00:00
|
|
|
# Provide any necessary per-target variable overrides.
|
2012-11-23 13:22:47 +00:00
|
|
|
|
2013-11-19 11:14:36 +00:00
|
|
|
cygcheck.exe: MINGW_LDFLAGS += ${ZLIB} -lwininet -lpsapi -lntdll
|
2012-11-23 13:22:47 +00:00
|
|
|
cygcheck.exe: ${CYGCHECK_OBJS}
|
|
|
|
|
|
|
|
cygpath.o: CXXFLAGS += -fno-threadsafe-statics
|
2013-05-21 09:32:12 +00:00
|
|
|
cygpath.exe: CYGWIN_LDFLAGS += -lcygwin -luserenv -lntdll
|
|
|
|
ps.exe: CYGWIN_LDFLAGS += -lcygwin -lpsapi -lntdll
|
2011-09-15 16:49:51 +00:00
|
|
|
strace.exe: MINGW_LDFLAGS += -lntdll
|
2008-03-08 17:52:49 +00:00
|
|
|
|
2019-08-14 22:59:43 -07:00
|
|
|
ldd.exe:CYGWIN_LDFLAGS += -lpsapi -lntdll
|
2012-11-23 13:22:47 +00:00
|
|
|
pldd.exe: CYGWIN_LDFLAGS += -lpsapi
|
2014-05-13 10:24:16 +00:00
|
|
|
minidumper.exe: CYGWIN_LDFLAGS += -ldbghelp
|
2009-01-09 05:11:57 +00:00
|
|
|
|
2012-11-23 13:22:47 +00:00
|
|
|
ldh.exe: MINGW_LDFLAGS += -nostdlib -lkernel32
|
2009-03-18 04:19:05 +00:00
|
|
|
|
2008-03-08 17:52:49 +00:00
|
|
|
# Check for dumper's requirements and enable it if found.
|
2012-11-23 13:22:47 +00:00
|
|
|
libbfd := $(call libname,libbfd.a)
|
|
|
|
build_dumper := $(shell test -r "$(libbfd)" && echo 1)
|
|
|
|
|
2008-03-08 17:52:49 +00:00
|
|
|
ifdef build_dumper
|
|
|
|
CYGWIN_BINS += dumper.exe
|
2020-07-04 15:51:14 +01:00
|
|
|
dumper.o module_info.o: CXXFLAGS += -I$(top_srcdir)/include
|
|
|
|
dumper.o: dumper.h
|
|
|
|
dumper.exe: module_info.o
|
2020-07-07 20:54:27 +01:00
|
|
|
dumper.exe: CYGWIN_LDFLAGS += -lpsapi -lbfd -lintl -liconv -liberty ${ZLIB} -lntdll
|
2001-11-11 03:06:59 +00:00
|
|
|
else
|
2008-03-08 17:52:49 +00:00
|
|
|
all: warn_dumper
|
2001-11-11 03:06:59 +00:00
|
|
|
endif
|
|
|
|
|
2008-03-08 17:52:49 +00:00
|
|
|
all: Makefile $(CYGWIN_BINS) $(MINGW_BINS)
|
2000-08-24 19:03:12 +00:00
|
|
|
|
2008-03-09 04:10:10 +00: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,$^} $@
|
2020-12-01 10:10:40 +01:00
|
|
|
path-testsuite.o: MINGW_CXXFLAGS += -DTESTSUITE
|
2008-03-09 04:10:10 +00:00
|
|
|
# this is necessary because this .c lives in the build dir instead of src
|
2020-11-12 14:56:09 +00:00
|
|
|
path-testsuite.o: MINGW_CXXFLAGS += -I$(srcdir)
|
2008-03-09 04:10:10 +00:00
|
|
|
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 17:52:49 +00:00
|
|
|
# how to compile a MinGW object
|
|
|
|
$(MINGW_OBJS): %.o: %.cc
|
2017-03-16 15:02:20 +00:00
|
|
|
${MINGW_CXX} -c -o $@ ${CXXFLAGS} $(MINGW_CXXFLAGS) $<
|
2001-11-11 06:07:36 +00:00
|
|
|
|
2008-03-08 17:52:49 +00:00
|
|
|
# how to link a MinGW binary
|
|
|
|
$(MINGW_BINS): %.exe: %.o
|
2012-11-07 16:32:08 +00:00
|
|
|
$(MINGW_CXX) $(MINGW_CXXFLAGS) -o $@ ${filter %.o,$^} $(MINGW_LDFLAGS)
|
2007-08-03 19:41:48 +00:00
|
|
|
|
2008-03-08 17:52:49 +00:00
|
|
|
# how to link a Cygwin binary
|
2008-10-12 03:08:33 +00:00
|
|
|
$(CYGWIN_BINS): %.exe: %.o
|
2012-11-23 13:22:47 +00:00
|
|
|
${CXX} -o $@ $(filter %.o,$^) -B${cygwin_build}/ ${LDFLAGS} ${CYGWIN_LDFLAGS}
|
2002-01-22 03:17:59 +00:00
|
|
|
|
2008-03-08 17:52:49 +00:00
|
|
|
# note: how to compile a Cygwin object is covered by the pattern rule in Makefile.common
|
2002-01-22 03:17:59 +00:00
|
|
|
|
2008-03-08 17:52:49 +00:00
|
|
|
# these dependencies ensure that the required in-tree libs are built first
|
2012-11-23 13:22:47 +00:00
|
|
|
$(MINGW_BINS): $(DEP_LDLIBS)
|
|
|
|
$(CYGWIN_BINS): $(DEP_LDLIBS)
|
2002-05-13 05:13:58 +00:00
|
|
|
|
2012-11-28 03:22:36 +00:00
|
|
|
cygcheck.o cygpath.o module_info.o path.o ps.o regtool.o strace.o: loadlib.h
|
|
|
|
|
2012-11-23 13:22:47 +00:00
|
|
|
.PHONY: clean
|
2000-02-17 19:38:33 +00:00
|
|
|
clean:
|
2008-03-09 04:10:10 +00:00
|
|
|
rm -f *.o $(CYGWIN_BINS) $(MINGW_BINS) path-testsuite.cc testsuite.exe
|
2000-02-17 19:38:33 +00:00
|
|
|
|
2012-11-23 13:22:47 +00:00
|
|
|
.PHONY: realclean
|
2000-02-17 19:38:33 +00:00
|
|
|
realclean: clean
|
2008-03-08 17:52:49 +00:00
|
|
|
rm -f Makefile config.cache
|
2000-02-17 19:38:33 +00:00
|
|
|
|
2012-11-23 13:22:47 +00:00
|
|
|
.PHONY: install
|
2000-02-17 19:38:33 +00:00
|
|
|
install: all
|
2012-11-23 13:22:47 +00:00
|
|
|
/bin/mkdir -p ${DESTDIR}${bindir}
|
2008-03-09 09:41:42 +00:00
|
|
|
for i in $(CYGWIN_BINS) ${filter-out testsuite.exe,$(MINGW_BINS)} ; do \
|
2020-10-12 14:18:17 +01:00
|
|
|
$(INSTALL_PROGRAM) $$i $(DESTDIR)$(bindir)/$$i; \
|
2000-02-17 19:38:33 +00:00
|
|
|
done
|
|
|
|
|
2012-11-23 13:22:47 +00:00
|
|
|
.PHONY: warn_dumper
|
2000-08-25 16:50:08 +00:00
|
|
|
warn_dumper:
|
2011-08-21 19:36:52 +00: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 16:56:00 +00:00
|
|
|
@echo '*** If you need this program, check out the naked-bfd and naked-intl'
|
2008-07-30 06:07:42 +00:00
|
|
|
@echo '*** sources from sourceware.org. Then, configure and build these'
|
2000-09-10 16:56:00 +00:00
|
|
|
@echo '*** libraries. Otherwise, you can safely ignore this warning.'
|