2000-02-18 03:38:33 +08:00
|
|
|
# Makefile for Cygwin utilities
|
2006-01-17 23:37:13 +08:00
|
|
|
# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
|
|
|
# 2005, 2006 Red Hat, Inc.
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
SHELL:=@SHELL@
|
|
|
|
|
|
|
|
srcdir:=@srcdir@
|
|
|
|
VPATH:=@srcdir@
|
|
|
|
prefix:=@prefix@
|
|
|
|
exec_prefix:=@exec_prefix@
|
|
|
|
|
|
|
|
bindir:=@bindir@
|
|
|
|
program_transform_name:=@program_transform_name@
|
|
|
|
|
2003-07-26 08:10:48 +08:00
|
|
|
override INSTALL:=@INSTALL@
|
|
|
|
override INSTALL_PROGRAM:=@INSTALL_PROGRAM@
|
|
|
|
override INSTALL_DATA:=@INSTALL_DATA@
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
EXEEXT:=@EXEEXT@
|
|
|
|
EXEEXT_FOR_BUILD:=@EXEEXT_FOR_BUILD@
|
|
|
|
|
|
|
|
CC:=@CC@
|
|
|
|
CC_FOR_TARGET:=$(CC)
|
2000-12-03 13:42:03 +08:00
|
|
|
CXX:=@CXX@
|
2000-10-28 13:39:38 +08:00
|
|
|
CXX_FOR_TARGET:=$(CXX)
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
CFLAGS:=@CFLAGS@
|
2002-01-22 11:22:55 +08:00
|
|
|
CXXFLAGS:=@CXXFLAGS@
|
2002-02-28 00:10:17 +08:00
|
|
|
override CXXFLAGS+=-fno-exceptions -fno-rtti -DHAVE_DECL_GETOPT=0
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
include $(srcdir)/../Makefile.common
|
|
|
|
|
2004-02-21 12:51:15 +08:00
|
|
|
LIBICONV:=@libiconv@
|
2002-02-28 00:10:17 +08:00
|
|
|
libbfd:=${shell $(CC) -B$(bupdir2)/bfd/ --print-file-name=libbfd.a}
|
|
|
|
libintl:=${shell $(CC) -B$(bupdir2)/intl/ --print-file-name=libintl.a}
|
2004-02-21 12:51:15 +08:00
|
|
|
build_dumper:=${shell test -r $(libbfd) -a -r $(libintl) -a -n "$(LIBICONV)" && echo 1}
|
2000-08-26 00:50:08 +08:00
|
|
|
|
2003-09-12 09:51:21 +08:00
|
|
|
libz:=${shell x=$$($(CC) -mno-cygwin --print-file-name=libz.a); cd $$(dirname $$x); dir=$$(pwd); case "$$dir" in *mingw*) echo $$dir/libz.a ;; esac}
|
|
|
|
zlib_h:=-include ${patsubst %/lib/mingw/libz.a,%/include/zlib.h,${patsubst %/lib/libz.a,%/include/zlib.h,$(libz)}}
|
|
|
|
zconf_h:=${patsubst %/zlib.h,%/zconf.h,$(zlib_h)}
|
|
|
|
ifeq "${libz}" ""
|
2003-09-08 10:50:02 +08:00
|
|
|
zlib_h:=
|
|
|
|
zconf_h:=
|
|
|
|
libz:=
|
|
|
|
endif
|
|
|
|
|
2000-08-25 03:03:12 +08:00
|
|
|
DUMPER_INCLUDES:=-I$(bupdir2)/bfd -I$(updir1)/include
|
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
libcygwin:=$(cygwin_build)/libcygwin.a
|
|
|
|
libuser32:=$(w32api_lib)/libuser32.a
|
|
|
|
libkernel32:=$(w32api_lib)/libkernel32.a
|
|
|
|
ALL_DEP_LDLIBS:=$(libcygwin) $(w32api_lib)/libnetapi32.a \
|
|
|
|
$(w32api_lib)/libadvapi32.a $(w32api_lib)/libkernel32.a \
|
|
|
|
$(w32api_lib)/libuser32.a
|
|
|
|
|
|
|
|
ALL_LDLIBS:=${patsubst $(w32api_lib)/lib%.a,-l%,\
|
|
|
|
${filter-out $(libuser32),\
|
|
|
|
${filter-out $(libkernel32),\
|
|
|
|
${filter-out $(libcygwin), $(ALL_DEP_LDLIBS)}}}}
|
|
|
|
|
|
|
|
MINGW_LIB:=$(mingw_build)/libmingw32.a
|
2002-07-07 08:54:38 +08:00
|
|
|
DUMPER_LIB:=${libbfd} ${libintl} -L$(bupdir1)/libiberty $(LIBICONV) -liberty
|
2003-09-11 10:00:42 +08:00
|
|
|
MINGW_LDLIBS:=${filter-out $(libcygwin),$(ALL_LDLIBS) $(MINGW_LIB)}
|
2000-03-19 01:45:35 +08:00
|
|
|
MINGW_DEP_LDLIBS:=${ALL_DEP_LDLIBS} ${MINGW_LIB}
|
2003-01-23 01:15:53 +08:00
|
|
|
ALL_LDFLAGS:=-B$(newlib_build)/libc -B$(w32api_lib) $(LDFLAGS) $(ALL_LDLIBS)
|
2000-10-28 13:00:00 +08:00
|
|
|
DUMPER_LDFLAGS:=$(ALL_LDFLAGS) $(DUMPER_LIB)
|
2003-09-11 10:00:42 +08:00
|
|
|
MINGW_CXX:=${patsubst %/cygwin/include,%/mingw/include,${filter-out -I$(newlib_source)/%,$(COMPILE_CXX)}} -I$(updir)
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-10-25 06:09:37 +08:00
|
|
|
PROGS:= cygcheck.exe cygpath.exe getfacl.exe kill.exe mkgroup.exe \
|
2001-10-25 05:56:54 +08:00
|
|
|
mkpasswd.exe mount.exe passwd.exe ps.exe regtool.exe setfacl.exe \
|
2006-07-04 00:00:58 +08:00
|
|
|
setmetamode.exe ssp.exe strace.exe umount.exe ipcrm.exe ipcs.exe
|
2000-08-26 00:50:08 +08:00
|
|
|
|
2000-08-29 09:58:00 +08:00
|
|
|
CLEAN_PROGS:=$(PROGS)
|
2003-10-18 01:19:31 +08:00
|
|
|
ifndef build_dumper
|
2000-08-26 00:50:08 +08:00
|
|
|
PROGS:=warn_dumper $(PROGS)
|
2003-10-18 01:19:31 +08:00
|
|
|
else
|
|
|
|
PROGS+=dumper$(EXEEXT)
|
2000-08-29 09:58:00 +08:00
|
|
|
CLEAN_PROGS+=dumper.exe
|
2000-08-26 00:50:08 +08:00
|
|
|
endif
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
.SUFFIXES:
|
|
|
|
.NOEXPORT:
|
|
|
|
|
2000-08-26 00:50:08 +08:00
|
|
|
.PHONY: all install clean realclean warn_dumper
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
all: Makefile $(PROGS)
|
|
|
|
|
2003-09-11 05:55:59 +08:00
|
|
|
strace.exe: strace.o path.o $(MINGW_DEP_LDLIBS)
|
2000-02-18 03:38:33 +08:00
|
|
|
ifdef VERBOSE
|
2003-09-11 08:07:28 +08:00
|
|
|
$(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,2,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
|
2000-02-18 03:38:33 +08:00
|
|
|
else
|
2000-10-28 13:39:38 +08:00
|
|
|
@echo $(CXX) -o $@ ${wordlist 1,2,$^} ${filter-out -B%, $(MINGW_CXXFLAGS) $(MINGW_LDFLAGS)};\
|
2003-09-11 08:07:28 +08:00
|
|
|
$(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,2,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
|
2000-02-18 03:38:33 +08:00
|
|
|
endif
|
|
|
|
|
2006-01-15 17:29:02 +08:00
|
|
|
cygcheck.exe: cygcheck.o path.o dump_setup.o $(MINGW_DEP_LDLIBS)
|
2003-09-08 10:50:02 +08:00
|
|
|
ifeq "$(libz)" ""
|
2003-09-12 09:51:21 +08:00
|
|
|
@echo '*** Building cygcheck without package content checking due to missing mingw libz.a.'
|
2003-09-08 10:50:02 +08:00
|
|
|
endif
|
2001-11-11 11:06:59 +08:00
|
|
|
ifdef VERBOSE
|
2006-01-15 17:29:02 +08:00
|
|
|
$(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,3,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS) $(libz)
|
2001-11-11 11:06:59 +08:00
|
|
|
else
|
2006-01-15 17:29:02 +08:00
|
|
|
@echo $(CXX) -o $@ ${wordlist 1,3,$^} ${filter-out -B%, $(MINGW_CXXFLAGS) $(MINGW_LDFLAGS)} $(libz);\
|
|
|
|
$(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,3,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS) $(libz)
|
2001-11-11 11:06:59 +08:00
|
|
|
endif
|
|
|
|
|
2000-08-25 03:03:12 +08:00
|
|
|
dumper.o: dumper.cc dumper.h
|
2000-10-28 13:39:38 +08:00
|
|
|
ifdef VERBOSE
|
2001-10-13 13:33:47 +08:00
|
|
|
${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $@ $(DUMPER_INCLUDES) ${firstword $^}
|
2000-10-28 13:39:38 +08:00
|
|
|
else
|
2000-12-11 08:10:49 +08:00
|
|
|
@echo $(CXX) $c $(CFLAGS) $(DUMPER_INCLUDES) ... $(basename $@).cc;\
|
2001-10-13 13:33:47 +08:00
|
|
|
${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(DUMPER_INCLUDES) $<
|
2000-10-28 13:39:38 +08:00
|
|
|
endif
|
|
|
|
|
2000-08-25 03:03:12 +08:00
|
|
|
module_info.o: module_info.cc
|
2000-10-28 13:39:38 +08:00
|
|
|
ifdef VERBOSE
|
2001-10-13 13:33:47 +08:00
|
|
|
${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $@ $(DUMPER_INCLUDES) ${firstword $^}
|
2000-10-28 13:39:38 +08:00
|
|
|
else
|
2000-12-11 08:10:49 +08:00
|
|
|
@echo $(CXX) $c $(CFLAGS) $(DUMPER_INCLUDES) ... $(basename $@).cc;\
|
2001-10-13 13:33:47 +08:00
|
|
|
${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(DUMPER_INCLUDES) $<
|
2000-10-28 13:39:38 +08:00
|
|
|
endif
|
2000-08-25 03:03:12 +08:00
|
|
|
|
|
|
|
parse_pe.o: parse_pe.cc dumper.h
|
2000-10-28 13:39:38 +08:00
|
|
|
ifdef VERBOSE
|
2001-10-13 13:33:47 +08:00
|
|
|
${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $@ $(DUMPER_INCLUDES) ${firstword $^}
|
2000-10-28 13:39:38 +08:00
|
|
|
else
|
2000-12-11 08:10:49 +08:00
|
|
|
@echo $(CXX) $c $(CFLAGS) $(DUMPER_INCLUDES) ... $(basename $@).cc;\
|
2001-10-13 13:33:47 +08:00
|
|
|
${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(DUMPER_INCLUDES) $<
|
2000-10-28 13:39:38 +08:00
|
|
|
endif
|
2000-08-25 03:03:12 +08:00
|
|
|
|
2001-11-11 11:06:59 +08:00
|
|
|
path.o: path.cc
|
|
|
|
ifdef VERBOSE
|
2003-09-11 10:00:42 +08:00
|
|
|
$(MINGW_CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
|
2001-11-11 11:06:59 +08:00
|
|
|
else
|
2003-09-11 10:00:42 +08:00
|
|
|
@echo $(MINGW_CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) ... $^;\
|
|
|
|
${MINGW_CXX} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
|
2001-11-11 11:06:59 +08:00
|
|
|
endif
|
|
|
|
|
2001-11-11 14:07:36 +08:00
|
|
|
dump_setup.o: dump_setup.cc
|
|
|
|
ifdef VERBOSE
|
2003-09-11 10:00:42 +08:00
|
|
|
$(MINGW_CXX) $(zconf_h) $(zlib_h) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
|
2001-11-11 14:07:36 +08:00
|
|
|
else
|
2003-09-11 10:00:42 +08:00
|
|
|
@echo $(MINGW_CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) ... $^;\
|
|
|
|
$(MINGW_CXX) $(zconf_h) $(zlib_h) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
|
2001-11-11 14:07:36 +08:00
|
|
|
endif
|
|
|
|
|
2002-01-22 11:17:59 +08:00
|
|
|
cygcheck.o: cygcheck.cc
|
|
|
|
ifdef VERBOSE
|
2003-09-11 10:56:40 +08:00
|
|
|
${MINGW_CXX} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) -I$(updir) $<
|
2002-01-22 11:17:59 +08:00
|
|
|
else
|
2003-09-11 10:56:40 +08:00
|
|
|
@echo $(MINGW_CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) ... $^;\
|
|
|
|
${MINGW_CXX} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) -I$(updir) $<
|
2002-01-22 11:17:59 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
strace.o: strace.cc
|
|
|
|
ifdef VERBOSE
|
2003-09-11 10:00:42 +08:00
|
|
|
$(MINGW_CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) -I$(updir) $<
|
2002-01-22 11:17:59 +08:00
|
|
|
else
|
2003-09-11 10:00:42 +08:00
|
|
|
@echo $(MINGW_CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) ... $^;\
|
|
|
|
$(MINGW_CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) -I$(updir) $<
|
2002-01-22 11:17:59 +08:00
|
|
|
endif
|
|
|
|
|
2002-05-13 13:13:58 +08:00
|
|
|
kill.exe: kill.o $(bupdir1)/libiberty/strsignal.o
|
|
|
|
ifdef VERBOSE
|
|
|
|
$(CXX) -o $@ $^ -B$(cygwin_build)/ $(ALL_LDFLAGS) $(KILL_LIB)
|
|
|
|
else
|
|
|
|
@echo $(CXX) -o $@ $^ ${filter-out -B%, $(ALL_LDFLAGS)};\
|
|
|
|
$(CXX) -o $@ $^ -B$(cygwin_build)/ $(ALL_LDFLAGS) $(KILL_LIB)
|
|
|
|
endif
|
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
clean:
|
2000-08-29 09:58:00 +08:00
|
|
|
rm -f *.o $(CLEAN_PROGS)
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
realclean: clean
|
|
|
|
rm -f Makefile config.cache
|
|
|
|
|
|
|
|
install: all
|
2006-01-18 23:57:56 +08:00
|
|
|
$(SHELL) $(updir1)/mkinstalldirs $(bindir)
|
2000-02-18 03:38:33 +08:00
|
|
|
for i in $(PROGS) ; do \
|
|
|
|
n=`echo $$i | sed '$(program_transform_name)'`; \
|
|
|
|
$(INSTALL_PROGRAM) $$i $(bindir)/$$n; \
|
|
|
|
done
|
|
|
|
|
|
|
|
$(cygwin_build)/libcygwin.a: $(cygwin_build)/Makefile
|
|
|
|
@$(MAKE) -C $(@D) $(@F)
|
|
|
|
|
|
|
|
$(mingw_build)/libmingw32.a: $(mingw_build)/Makefile
|
|
|
|
@$(MAKE) -C $(@D) $(@F)
|
|
|
|
|
2000-08-26 00:50:08 +08:00
|
|
|
warn_dumper:
|
2000-09-11 00:56:00 +08:00
|
|
|
@echo '*** Not building dumper.exe since some required libraries are'
|
|
|
|
@echo '*** missing: libbfd.a and libintl.a.'
|
|
|
|
@echo '*** If you need this program, check out the naked-bfd and naked-intl'
|
|
|
|
@echo '*** sources from sources.redhat.com. Then, configure and build these'
|
|
|
|
@echo '*** libraries. Otherwise, you can safely ignore this warning.'
|
2000-08-26 00:50:08 +08:00
|
|
|
|
2000-08-25 03:03:12 +08:00
|
|
|
dumper.exe: module_info.o parse_pe.o dumper.o $(ALL_DEP_LDLIBS)
|
|
|
|
ifdef VERBOSE
|
2000-10-28 13:39:38 +08:00
|
|
|
$(CXX) -o $@ ${wordlist 1,3,$^} -B$(cygwin_build)/ $(DUMPER_LDFLAGS)
|
2000-08-25 03:03:12 +08:00
|
|
|
else
|
2000-10-28 13:39:38 +08:00
|
|
|
@echo $(CXX) -o $@ ${wordlist 1,3,$^} ${filter-out -B%, $(DUMPER_LDFLAGS)};\
|
|
|
|
$(CXX) -o $@ ${wordlist 1,3,$^} -B$(cygwin_build)/ $(DUMPER_LDFLAGS)
|
2000-08-25 03:03:12 +08:00
|
|
|
endif
|
|
|
|
|
2006-08-02 17:48:18 +08:00
|
|
|
cygpath.exe: cygpath.o $(ALL_DEP_LDLIBS)
|
|
|
|
ifdef VERBOSE
|
|
|
|
$(CXX) -o $@ ${firstword $^} -B$(cygwin_build)/ $(ALL_LDFLAGS) -lntdll
|
|
|
|
else
|
|
|
|
@echo $(CXX) -o $@ ${firstword $^} ${filter-out -B%, $(ALL_LDFLAGS) -ntdll};\
|
|
|
|
$(CXX) -o $@ ${firstword $^} -B$(cygwin_build)/ $(ALL_LDFLAGS) -ntdll
|
|
|
|
endif
|
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
%.exe: %.o $(ALL_DEP_LDLIBS)
|
|
|
|
ifdef VERBOSE
|
2003-09-01 10:33:50 +08:00
|
|
|
$(CXX) -o $@ ${firstword $^} -B$(cygwin_build)/ $(ALL_LDFLAGS)
|
2000-02-18 03:38:33 +08:00
|
|
|
else
|
2003-09-01 10:33:50 +08:00
|
|
|
@echo $(CXX) -o $@ ${firstword $^} ... ${filter-out -B%, $(ALL_LDFLAGS)};\
|
2000-10-28 13:39:38 +08:00
|
|
|
$(CXX) -o $@ ${firstword $^} -B$(cygwin_build)/ $(ALL_LDFLAGS)
|
2000-02-18 03:38:33 +08:00
|
|
|
endif
|