2000-02-17 20:38:33 +01:00
|
|
|
# Makefile for Cygwin utilities
|
2006-01-17 16:37:13 +01:00
|
|
|
# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
2007-08-03 21:41:48 +02:00
|
|
|
# 2005, 2006, 2007 Red Hat, Inc.
|
2000-02-17 20:38:33 +01: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 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@
|
|
|
|
|
|
|
|
CC:=@CC@
|
|
|
|
CC_FOR_TARGET:=$(CC)
|
2000-12-03 06:42:03 +01:00
|
|
|
CXX:=@CXX@
|
2000-10-28 07:39:38 +02:00
|
|
|
CXX_FOR_TARGET:=$(CXX)
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
CFLAGS:=@CFLAGS@
|
2002-01-22 04:22:55 +01:00
|
|
|
CXXFLAGS:=@CXXFLAGS@
|
2002-02-27 17:10:17 +01:00
|
|
|
override CXXFLAGS+=-fno-exceptions -fno-rtti -DHAVE_DECL_GETOPT=0
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
include $(srcdir)/../Makefile.common
|
|
|
|
|
2004-02-21 05:51:15 +01:00
|
|
|
LIBICONV:=@libiconv@
|
2002-02-27 17:10:17 +01: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 05:51:15 +01:00
|
|
|
build_dumper:=${shell test -r $(libbfd) -a -r $(libintl) -a -n "$(LIBICONV)" && echo 1}
|
2000-08-25 18:50:08 +02:00
|
|
|
|
2003-09-12 03:51:21 +02: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 04:50:02 +02:00
|
|
|
zlib_h:=
|
|
|
|
zconf_h:=
|
|
|
|
libz:=
|
|
|
|
endif
|
|
|
|
|
2000-08-24 21:03:12 +02:00
|
|
|
DUMPER_INCLUDES:=-I$(bupdir2)/bfd -I$(updir1)/include
|
|
|
|
|
2000-02-17 20:38:33 +01: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 02:54:38 +02:00
|
|
|
DUMPER_LIB:=${libbfd} ${libintl} -L$(bupdir1)/libiberty $(LIBICONV) -liberty
|
2003-09-11 04:00:42 +02:00
|
|
|
MINGW_LDLIBS:=${filter-out $(libcygwin),$(ALL_LDLIBS) $(MINGW_LIB)}
|
2000-03-18 18:45:35 +01:00
|
|
|
MINGW_DEP_LDLIBS:=${ALL_DEP_LDLIBS} ${MINGW_LIB}
|
2003-01-22 18:15:53 +01:00
|
|
|
ALL_LDFLAGS:=-B$(newlib_build)/libc -B$(w32api_lib) $(LDFLAGS) $(ALL_LDLIBS)
|
2000-10-28 07:00:00 +02:00
|
|
|
DUMPER_LDFLAGS:=$(ALL_LDFLAGS) $(DUMPER_LIB)
|
2003-09-11 04:00:42 +02:00
|
|
|
MINGW_CXX:=${patsubst %/cygwin/include,%/mingw/include,${filter-out -I$(newlib_source)/%,$(COMPILE_CXX)}} -I$(updir)
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2001-10-25 00:09:37 +02:00
|
|
|
PROGS:= cygcheck.exe cygpath.exe getfacl.exe kill.exe mkgroup.exe \
|
2001-10-24 23:56:54 +02:00
|
|
|
mkpasswd.exe mount.exe passwd.exe ps.exe regtool.exe setfacl.exe \
|
2006-07-03 18:00:58 +02:00
|
|
|
setmetamode.exe ssp.exe strace.exe umount.exe ipcrm.exe ipcs.exe
|
2000-08-25 18:50:08 +02:00
|
|
|
|
2000-08-29 03:58:00 +02:00
|
|
|
CLEAN_PROGS:=$(PROGS)
|
2003-10-17 19:19:31 +02:00
|
|
|
ifndef build_dumper
|
2000-08-25 18:50:08 +02:00
|
|
|
PROGS:=warn_dumper $(PROGS)
|
2003-10-17 19:19:31 +02:00
|
|
|
else
|
|
|
|
PROGS+=dumper$(EXEEXT)
|
2000-08-29 03:58:00 +02:00
|
|
|
CLEAN_PROGS+=dumper.exe
|
2000-08-25 18:50:08 +02:00
|
|
|
endif
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
.SUFFIXES:
|
|
|
|
.NOEXPORT:
|
|
|
|
|
2000-08-25 18:50:08 +02:00
|
|
|
.PHONY: all install clean realclean warn_dumper
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
all: Makefile $(PROGS)
|
|
|
|
|
2003-09-10 23:55:59 +02:00
|
|
|
strace.exe: strace.o path.o $(MINGW_DEP_LDLIBS)
|
2000-02-17 20:38:33 +01:00
|
|
|
ifdef VERBOSE
|
2003-09-11 02:07:28 +02:00
|
|
|
$(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,2,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
|
2000-02-17 20:38:33 +01:00
|
|
|
else
|
2000-10-28 07:39:38 +02:00
|
|
|
@echo $(CXX) -o $@ ${wordlist 1,2,$^} ${filter-out -B%, $(MINGW_CXXFLAGS) $(MINGW_LDFLAGS)};\
|
2003-09-11 02:07:28 +02:00
|
|
|
$(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,2,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
|
2000-02-17 20:38:33 +01:00
|
|
|
endif
|
|
|
|
|
2007-08-03 21:41:48 +02:00
|
|
|
cygcheck.exe: cygcheck.o bloda.o path.o dump_setup.o $(MINGW_DEP_LDLIBS)
|
2003-09-08 04:50:02 +02:00
|
|
|
ifeq "$(libz)" ""
|
2003-09-12 03:51:21 +02:00
|
|
|
@echo '*** Building cygcheck without package content checking due to missing mingw libz.a.'
|
2003-09-08 04:50:02 +02:00
|
|
|
endif
|
2001-11-11 04:06:59 +01:00
|
|
|
ifdef VERBOSE
|
2007-08-03 21:41:48 +02:00
|
|
|
$(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,4,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS) $(libz) -lntdll
|
2001-11-11 04:06:59 +01:00
|
|
|
else
|
2007-08-03 21:41:48 +02:00
|
|
|
@echo $(CXX) -o $@ ${wordlist 1,4,$^} ${filter-out -B%, $(MINGW_CXXFLAGS) $(MINGW_LDFLAGS)} $(libz) -lntdll;\
|
|
|
|
$(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,4,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS) $(libz) -lntdll
|
2001-11-11 04:06:59 +01:00
|
|
|
endif
|
|
|
|
|
2000-08-24 21:03:12 +02:00
|
|
|
dumper.o: dumper.cc dumper.h
|
2000-10-28 07:39:38 +02:00
|
|
|
ifdef VERBOSE
|
2001-10-13 07:33:47 +02:00
|
|
|
${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $@ $(DUMPER_INCLUDES) ${firstword $^}
|
2000-10-28 07:39:38 +02:00
|
|
|
else
|
2000-12-11 01:10:49 +01:00
|
|
|
@echo $(CXX) $c $(CFLAGS) $(DUMPER_INCLUDES) ... $(basename $@).cc;\
|
2001-10-13 07:33:47 +02:00
|
|
|
${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(DUMPER_INCLUDES) $<
|
2000-10-28 07:39:38 +02:00
|
|
|
endif
|
|
|
|
|
2000-08-24 21:03:12 +02:00
|
|
|
module_info.o: module_info.cc
|
2000-10-28 07:39:38 +02:00
|
|
|
ifdef VERBOSE
|
2001-10-13 07:33:47 +02:00
|
|
|
${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $@ $(DUMPER_INCLUDES) ${firstword $^}
|
2000-10-28 07:39:38 +02:00
|
|
|
else
|
2000-12-11 01:10:49 +01:00
|
|
|
@echo $(CXX) $c $(CFLAGS) $(DUMPER_INCLUDES) ... $(basename $@).cc;\
|
2001-10-13 07:33:47 +02:00
|
|
|
${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(DUMPER_INCLUDES) $<
|
2000-10-28 07:39:38 +02:00
|
|
|
endif
|
2000-08-24 21:03:12 +02:00
|
|
|
|
|
|
|
parse_pe.o: parse_pe.cc dumper.h
|
2000-10-28 07:39:38 +02:00
|
|
|
ifdef VERBOSE
|
2001-10-13 07:33:47 +02:00
|
|
|
${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $@ $(DUMPER_INCLUDES) ${firstword $^}
|
2000-10-28 07:39:38 +02:00
|
|
|
else
|
2000-12-11 01:10:49 +01:00
|
|
|
@echo $(CXX) $c $(CFLAGS) $(DUMPER_INCLUDES) ... $(basename $@).cc;\
|
2001-10-13 07:33:47 +02:00
|
|
|
${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(DUMPER_INCLUDES) $<
|
2000-10-28 07:39:38 +02:00
|
|
|
endif
|
2000-08-24 21:03:12 +02:00
|
|
|
|
2001-11-11 04:06:59 +01:00
|
|
|
path.o: path.cc
|
|
|
|
ifdef VERBOSE
|
2003-09-11 04:00:42 +02:00
|
|
|
$(MINGW_CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
|
2001-11-11 04:06:59 +01:00
|
|
|
else
|
2003-09-11 04:00:42 +02:00
|
|
|
@echo $(MINGW_CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) ... $^;\
|
|
|
|
${MINGW_CXX} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
|
2001-11-11 04:06:59 +01:00
|
|
|
endif
|
|
|
|
|
2001-11-11 07:07:36 +01:00
|
|
|
dump_setup.o: dump_setup.cc
|
|
|
|
ifdef VERBOSE
|
2003-09-11 04:00:42 +02:00
|
|
|
$(MINGW_CXX) $(zconf_h) $(zlib_h) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
|
2001-11-11 07:07:36 +01:00
|
|
|
else
|
2003-09-11 04:00:42 +02: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 07:07:36 +01:00
|
|
|
endif
|
|
|
|
|
2007-08-03 21:41:48 +02:00
|
|
|
bloda.o: bloda.cc
|
|
|
|
ifdef VERBOSE
|
|
|
|
${MINGW_CXX} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) -I$(updir) $<
|
|
|
|
else
|
|
|
|
@echo $(MINGW_CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) ... $^;\
|
|
|
|
${MINGW_CXX} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) -I$(updir) $<
|
|
|
|
endif
|
|
|
|
|
2002-01-22 04:17:59 +01:00
|
|
|
cygcheck.o: cygcheck.cc
|
|
|
|
ifdef VERBOSE
|
2003-09-11 04:56:40 +02:00
|
|
|
${MINGW_CXX} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) -I$(updir) $<
|
2002-01-22 04:17:59 +01:00
|
|
|
else
|
2003-09-11 04:56:40 +02: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 04:17:59 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
strace.o: strace.cc
|
|
|
|
ifdef VERBOSE
|
2003-09-11 04:00:42 +02:00
|
|
|
$(MINGW_CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) -I$(updir) $<
|
2002-01-22 04:17:59 +01:00
|
|
|
else
|
2003-09-11 04:00:42 +02: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 04:17:59 +01:00
|
|
|
endif
|
|
|
|
|
2007-07-10 02:12:54 +02:00
|
|
|
kill.exe: kill.o
|
2002-05-13 07:13:58 +02:00
|
|
|
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-17 20:38:33 +01:00
|
|
|
clean:
|
2000-08-29 03:58:00 +02:00
|
|
|
rm -f *.o $(CLEAN_PROGS)
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
realclean: clean
|
|
|
|
rm -f Makefile config.cache
|
|
|
|
|
|
|
|
install: all
|
2006-01-18 16:57:56 +01:00
|
|
|
$(SHELL) $(updir1)/mkinstalldirs $(bindir)
|
2000-02-17 20:38:33 +01: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-25 18:50:08 +02:00
|
|
|
warn_dumper:
|
2000-09-10 18:56:00 +02: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-25 18:50:08 +02:00
|
|
|
|
2000-08-24 21:03:12 +02:00
|
|
|
dumper.exe: module_info.o parse_pe.o dumper.o $(ALL_DEP_LDLIBS)
|
|
|
|
ifdef VERBOSE
|
2000-10-28 07:39:38 +02:00
|
|
|
$(CXX) -o $@ ${wordlist 1,3,$^} -B$(cygwin_build)/ $(DUMPER_LDFLAGS)
|
2000-08-24 21:03:12 +02:00
|
|
|
else
|
2000-10-28 07:39:38 +02:00
|
|
|
@echo $(CXX) -o $@ ${wordlist 1,3,$^} ${filter-out -B%, $(DUMPER_LDFLAGS)};\
|
|
|
|
$(CXX) -o $@ ${wordlist 1,3,$^} -B$(cygwin_build)/ $(DUMPER_LDFLAGS)
|
2000-08-24 21:03:12 +02:00
|
|
|
endif
|
|
|
|
|
2006-08-02 11:48:18 +02:00
|
|
|
cygpath.exe: cygpath.o $(ALL_DEP_LDLIBS)
|
|
|
|
ifdef VERBOSE
|
|
|
|
$(CXX) -o $@ ${firstword $^} -B$(cygwin_build)/ $(ALL_LDFLAGS) -lntdll
|
|
|
|
else
|
2006-09-12 17:14:51 +02:00
|
|
|
@echo $(CXX) -o $@ ${firstword $^} ${filter-out -B%, $(ALL_LDFLAGS) -lntdll};\
|
|
|
|
$(CXX) -o $@ ${firstword $^} -B$(cygwin_build)/ $(ALL_LDFLAGS) -lntdll
|
2006-08-02 11:48:18 +02:00
|
|
|
endif
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
%.exe: %.o $(ALL_DEP_LDLIBS)
|
|
|
|
ifdef VERBOSE
|
2003-09-01 04:33:50 +02:00
|
|
|
$(CXX) -o $@ ${firstword $^} -B$(cygwin_build)/ $(ALL_LDFLAGS)
|
2000-02-17 20:38:33 +01:00
|
|
|
else
|
2003-09-01 04:33:50 +02:00
|
|
|
@echo $(CXX) -o $@ ${firstword $^} ... ${filter-out -B%, $(ALL_LDFLAGS)};\
|
2000-10-28 07:39:38 +02:00
|
|
|
$(CXX) -o $@ ${firstword $^} -B$(cygwin_build)/ $(ALL_LDFLAGS)
|
2000-02-17 20:38:33 +01:00
|
|
|
endif
|