2000-02-18 03:38:33 +08:00
|
|
|
# Makefile for Cygwin utilities
|
2003-03-10 03:29:22 +08:00
|
|
|
# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 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@
|
|
|
|
etcdir:=$(exec_prefix)/etc
|
|
|
|
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
|
|
|
|
|
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}
|
2001-09-06 10:38:22 +08:00
|
|
|
build_dumper:=${shell test -r $(libbfd) && test -r ${libintl} && echo 1}
|
2000-08-26 00:50:08 +08:00
|
|
|
|
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)}}}}
|
|
|
|
|
2002-07-07 08:54:38 +08:00
|
|
|
LIBICONV:=@libiconv@
|
2000-02-18 03:38:33 +08:00
|
|
|
MINGW_LIB:=$(mingw_build)/libmingw32.a
|
2002-07-07 08:54:38 +08:00
|
|
|
DUMPER_LIB:=${libbfd} ${libintl} -L$(bupdir1)/libiberty $(LIBICONV) -liberty
|
2000-02-18 03:38:33 +08:00
|
|
|
MINGW_LDLIBS:=$(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)
|
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 \
|
|
|
|
ssp.exe strace.exe umount.exe
|
2000-08-26 00:50:08 +08:00
|
|
|
|
2000-08-29 09:58:00 +08:00
|
|
|
CLEAN_PROGS:=$(PROGS)
|
2000-08-26 00:50:08 +08:00
|
|
|
ifdef build_dumper
|
|
|
|
PROGS+=dumper$(EXEEXT)
|
|
|
|
else
|
|
|
|
PROGS:=warn_dumper $(PROGS)
|
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-03-04 13:30:50 +08:00
|
|
|
strace.exe: strace.o path.o mingw_getopt.o $(MINGW_DEP_LDLIBS)
|
2000-02-18 03:38:33 +08:00
|
|
|
ifdef VERBOSE
|
2003-03-04 13:30:50 +08:00
|
|
|
$(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,3,$^} -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-03-04 13:30:50 +08:00
|
|
|
$(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,3,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
|
2000-02-18 03:38:33 +08:00
|
|
|
endif
|
|
|
|
|
2002-01-22 11:17:59 +08:00
|
|
|
cygcheck.exe: cygcheck.o mingw_getopt.o path.o dump_setup.o $(MINGW_DEP_LDLIBS)
|
2001-11-11 11:06:59 +08:00
|
|
|
ifdef VERBOSE
|
2001-11-11 14:07:36 +08:00
|
|
|
$(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,4,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
|
2001-11-11 11:06:59 +08:00
|
|
|
else
|
|
|
|
@echo $(CXX) -o $@ ${wordlist 1,2,$^} ${filter-out -B%, $(MINGW_CXXFLAGS) $(MINGW_LDFLAGS)};\
|
2001-11-11 14:07:36 +08:00
|
|
|
$(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,4,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
|
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
|
|
|
|
2000-07-01 12:20:24 +08:00
|
|
|
mingw_getopt.o: $(cygwin_source)/lib/getopt.c
|
2000-10-28 13:39:38 +08:00
|
|
|
ifdef VERBOSE
|
2001-09-22 08:40:37 +08:00
|
|
|
${filter-out -I$(newlib_source)/%,$(COMPILE_CC)} $c -o $(@D)/$(basename $@)$o $(MINGW_CFLAGS) $<
|
2000-10-28 13:39:38 +08:00
|
|
|
else
|
|
|
|
@echo $(CC) $c -o $(@D)/$(basename $@)$o $(MINGW_CFLAGS) ... $^;\
|
2001-09-20 00:22:47 +08:00
|
|
|
${filter-out -I$(newlib_source)/%,$(COMPILE_CC)} $c -o $(@D)/$(basename $@)$o $(MINGW_CFLAGS) $<
|
2000-10-28 13:39:38 +08:00
|
|
|
endif
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-11-11 11:06:59 +08:00
|
|
|
path.o: path.cc
|
|
|
|
ifdef VERBOSE
|
2002-01-22 05:35:55 +08:00
|
|
|
${filter-out -I$(newlib_source)/%,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
|
2001-11-11 11:06:59 +08:00
|
|
|
else
|
2002-01-22 05:35:55 +08:00
|
|
|
@echo $(CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) ... $^;\
|
|
|
|
${filter-out -I$(newlib_source)/%,$(COMPILE_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
|
2002-01-22 05:35:55 +08:00
|
|
|
${filter-out -I$(newlib_source)/%,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
|
2001-11-11 14:07:36 +08:00
|
|
|
else
|
2002-01-22 05:35:55 +08:00
|
|
|
@echo $(CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) ... $^;\
|
|
|
|
${filter-out -I$(newlib_source)/%,$(COMPILE_CXX)} $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-03-01 11:38:19 +08:00
|
|
|
${CXX} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) -I$(updir) $<
|
2002-01-22 11:17:59 +08:00
|
|
|
else
|
|
|
|
@echo $(CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) ... $^;\
|
2003-03-01 11:38:19 +08:00
|
|
|
${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
|
2002-07-07 08:44:08 +08:00
|
|
|
${filter-out -I$(newlib_source)/%,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) -I$(updir) $<
|
2002-01-22 11:17:59 +08:00
|
|
|
else
|
|
|
|
@echo $(CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) ... $^;\
|
2002-07-07 08:44:08 +08:00
|
|
|
${filter-out -I$(newlib_source)/%,$(COMPILE_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
|
|
|
|
$(SHELL) $(updir1)/mkinstalldirs $(bindir) $(etcdir)
|
|
|
|
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
|
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
%.exe: %.o $(ALL_DEP_LDLIBS)
|
|
|
|
ifdef VERBOSE
|
2000-10-28 13:39:38 +08:00
|
|
|
$(CXX) -o $@ ${firstword $^} -B$(cygwin_build)/ $(ALL_LDFLAGS)
|
2000-02-18 03:38:33 +08:00
|
|
|
else
|
2000-10-28 13:39:38 +08:00
|
|
|
@echo $(CXX) -o $@ ${firstword $^} ${filter-out -B%, $(ALL_LDFLAGS)};\
|
|
|
|
$(CXX) -o $@ ${firstword $^} -B$(cygwin_build)/ $(ALL_LDFLAGS)
|
2000-02-18 03:38:33 +08:00
|
|
|
endif
|