2000-02-17 20:38:33 +01:00
|
|
|
# Makefile for Cygwin utilities
|
2000-04-03 03:29:06 +02:00
|
|
|
# Copyright 1996, 1997, 1998, 1999, 2000 Cygnus Solutions.
|
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@
|
|
|
|
etcdir:=$(exec_prefix)/etc
|
|
|
|
program_transform_name:=@program_transform_name@
|
|
|
|
|
|
|
|
INSTALL:=@INSTALL@
|
|
|
|
INSTALL_PROGRAM:=@INSTALL_PROGRAM@
|
|
|
|
INSTALL_DATA:=@INSTALL_DATA@
|
|
|
|
|
|
|
|
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@
|
2000-12-11 01:10:49 +01:00
|
|
|
CXXFLAGS:=@CXXFLAGS@ -fno-exceptions -fno-rtti
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
include $(srcdir)/../Makefile.common
|
|
|
|
|
2000-03-19 04:53:18 +01:00
|
|
|
MINGW_INCLUDES:=-I$(mingw_source)/include -I$(cygwin_source)/include -I$(w32api_include)
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2000-08-25 18:50:08 +02:00
|
|
|
libbfd:=$(bupdir2)/bfd/libbfd.a
|
|
|
|
libintl:=$(bupdir2)/intl/libintl.a
|
|
|
|
build_dumper:=${shell test -r $(libbfd) -a -r $(libintl) -a -d $(updir1)/include && echo 1}
|
|
|
|
|
2000-08-24 21:03:12 +02:00
|
|
|
DUMPER_INCLUDES:=-I$(bupdir2)/bfd -I$(updir1)/include
|
|
|
|
|
2000-03-18 18:45:35 +01:00
|
|
|
MINGW_CXXFLAGS:=$(CXXFLAGS) -mno-cygwin $(MINGW_INCLUDES)
|
2000-10-28 07:39:38 +02:00
|
|
|
MINGW_CFLAGS:=-mno-cygwin $(MINGW_INCLUDES)
|
2000-08-24 21:03:12 +02:00
|
|
|
|
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
|
2000-08-25 18:50:08 +02:00
|
|
|
DUMPER_LIB:=-L$(bupdir2)/bfd -lbfd -L$(bupdir1)/libiberty -liberty -L$(bupdir2)/intl -lintl
|
2000-02-17 20:38:33 +01:00
|
|
|
MINGW_LDLIBS:=$(ALL_LDLIBS) $(MINGW_LIB)
|
2000-03-18 18:45:35 +01:00
|
|
|
MINGW_DEP_LDLIBS:=${ALL_DEP_LDLIBS} ${MINGW_LIB}
|
2000-02-17 20:38:33 +01:00
|
|
|
ALL_LDFLAGS:=-B$(newlib_build)/libc/ -B$(newlib_build)/libm/ -B$(w32api_lib)/ \
|
|
|
|
$(LDFLAGS) $(ALL_LDLIBS)
|
|
|
|
MINGW_LDFLAGS:=$(ALL_LDFLAGS) $(MINGW_LIB)
|
2000-10-28 07:00:00 +02:00
|
|
|
DUMPER_LDFLAGS:=$(ALL_LDFLAGS) $(DUMPER_LIB)
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
PROGS:=mount$(EXEEXT) umount$(EXEEXT) ps$(EXEEXT) kill$(EXEEXT) \
|
|
|
|
mkpasswd$(EXEEXT) mkgroup$(EXEEXT) cygpath$(EXEEXT) cygcheck$(EXEEXT) \
|
|
|
|
passwd$(EXEEXT) getfacl$(EXEEXT) setfacl$(EXEEXT) strace$(EXEEXT) \
|
2000-10-19 04:13:52 +02:00
|
|
|
regtool$(EXEEXT) ssp$(EXEEXT)
|
2000-08-25 18:50:08 +02:00
|
|
|
|
2000-08-29 03:58:00 +02:00
|
|
|
CLEAN_PROGS:=$(PROGS)
|
2000-08-25 18:50:08 +02:00
|
|
|
ifdef build_dumper
|
|
|
|
PROGS+=dumper$(EXEEXT)
|
|
|
|
else
|
|
|
|
PROGS:=warn_dumper $(PROGS)
|
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)
|
|
|
|
|
2000-03-18 18:45:35 +01:00
|
|
|
strace.exe: strace.cc mingw_getopt.o $(MINGW_DEP_LDLIBS)
|
2000-02-17 20:38:33 +01:00
|
|
|
ifdef VERBOSE
|
2000-10-28 07:39:38 +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)};\
|
|
|
|
$(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,2,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
|
2000-02-17 20:38:33 +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
|
2000-12-11 01:10:49 +01:00
|
|
|
$(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;\
|
|
|
|
$(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
|
2000-12-11 01:10:49 +01:00
|
|
|
$(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;\
|
|
|
|
$(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
|
2000-12-11 01:10:49 +01:00
|
|
|
$(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;\
|
|
|
|
$(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
|
|
|
|
2000-07-01 06:20:24 +02:00
|
|
|
mingw_getopt.o: $(cygwin_source)/lib/getopt.c
|
2000-10-28 07:39:38 +02:00
|
|
|
ifdef VERBOSE
|
|
|
|
$(COMPILE_CC) $c -o $(@D)/$(basename $@)$o $(MINGW_CFLAGS) $<
|
|
|
|
else
|
|
|
|
@echo $(CC) $c -o $(@D)/$(basename $@)$o $(MINGW_CFLAGS) ... $^;\
|
|
|
|
$(COMPILE_CC) $c -o $(@D)/$(basename $@)$o $(MINGW_CFLAGS) $<
|
|
|
|
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
|
|
|
|
$(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-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
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
%.exe: %.o $(ALL_DEP_LDLIBS)
|
|
|
|
ifdef VERBOSE
|
2000-10-28 07:39:38 +02:00
|
|
|
$(CXX) -o $@ ${firstword $^} -B$(cygwin_build)/ $(ALL_LDFLAGS)
|
2000-02-17 20:38:33 +01:00
|
|
|
else
|
2000-10-28 07:39:38 +02:00
|
|
|
@echo $(CXX) -o $@ ${firstword $^} ${filter-out -B%, $(ALL_LDFLAGS)};\
|
|
|
|
$(CXX) -o $@ ${firstword $^} -B$(cygwin_build)/ $(ALL_LDFLAGS)
|
2000-02-17 20:38:33 +01:00
|
|
|
endif
|