#MMALLOC_CHECK = -DNO_MMALLOC_CHECK
MMALLOC_CFLAGS = ${MMALLOC_CHECK} ${MMALLOC_DISABLE}
-# Where is the source dir for the BFD library? Traditionally ../bfd or ./bfd
-# (When we want the binary library built from it, we use ${BFD_DIR}${subdir}.)
-BFD_DIR = ${srcdir}/../bfd
-BFD_DEP = $$(BFD_DIR)
-BFD_LIB = ./../bfd${subdir}/libbfd.a
+# Where are the source and binary directories for the BFD library?
+BFD_SRC_DIR = ${srcdir}/../bfd
+BFD_OBJ_DIR = ./../bfd${subdir}
+BFD_DEP = $$(BFD_SRC_DIR)
+BFD_LIB = $(BFD_OBJ_DIR)/libbfd.a
# Where is the source dir for the READLINE library? Traditionally in .. or .
# (For the binary library built from it, we use ${READLINE_DIR}${subdir}.)
DIST=gdb
LINT=/usr/5bin/lint
-LINTFLAGS= -I${BFD_DIR}
+LINTFLAGS= -I${BFD_SRC_DIR} -I${BFD_OBJ_DIR}
RUNTEST=runtest
RUNTESTFLAGS=
init.o $(OBS) $(TSOBS) $(ADD_FILES) $(CLIBS) $(LOADLIBES)
saber_gdb: $(SFILES) $(DEPFILES) copying.c version.c
- #setopt load_flags $(CFLAGS) -I$(BFD_DIR) -DHOST_SYS=SUN4_SYS
+ #setopt load_flags $(CFLAGS) -I$(BFD_SRC_DIR) -I${BFD_OBJ_DIR} -DHOST_SYS=SUN4_SYS
#load ./init.c $(SFILES)
#unload ${srcdir}/c-exp.y ${srcdir}/m2-exp.y ${srcdir}/ch-exp.y
#unload ${srcdir}/vx-share/*.h
@echo Ignore errors about non-existent system-supplied include files
@echo for systems other than the one you are using.
@echo Also ignore any errors in arm-convert.s.
- -$(GCC) -MM -nostdinc -I/usr/include -I${BFD_DIR} \
- -I${READLINE_DIR} $(INTERNAL_CFLAGS) \
+ -$(GCC) -MM -nostdinc -I/usr/include -I${BFD_SRC_DIR} \
+ -I${BFD_OBJ_DIR} -I${READLINE_DIR} $(INTERNAL_CFLAGS) \
`ls $(SOURCES) | grep -v '\.[hy]$$' | \
sort -u` >depend.tmp
#BEGIN COMMENTED OUT CODE -- this should now be taken care of below.
-e 's; $(INCLUDE_DIR)/; $(INCLUDE_DEP)/;g' \
-e 's; $(READLINE_DIR)/; $(READLINE_DEP)/;g' \
-e 's; [a-z0-9./]*bfd/; $(BFD_DEP)/;g' \
+ -e 's; $(BFD_DEP)/bfd\.h; ../bfd/bfd.h;g' \
+ -e 's; $(INCLUDE_DEP)/../bfd/bfd\.h; ../bfd/bfd.h;g' \
-e 's; \./xm.h; xm.h config.status;g' \
-e 's; \./tm.h; tm.h config.status;g' \
-e 's; \./nm.h; nm.h config.status;g' \
# There is one exception: the *.tab.c files can exist either in srcdir
# or in ., so make sure not to use an explicit rule for them.
#
-# Adding -I${BFD_DIR} is required for all the files which use BFD internals
+# Adding -I${BFD_SRC_DIR} and -I${BFD_OBJ_DIR} is required for all the files
+# which use BFD internals. This is because some bfd include files are in the
+# source directory, and some (bfd.h for example) are generated in the bfd
+# build directory.
# Adding -I${READLINE_DIR} is required because the readline header files
# are in readline not in include. They probably should be moved.
<depend.tm3 sed \
-e 'g' \
-e '/:.*\.tab\.c/d' \
-e 's/.*:\(.*\.c\).*/ $${CC} -c $${INTERNAL_CFLAGS} \1/' \
- -e 's;$${srcdir}/xcoffread.c;-I$${BFD_DIR} &;' \
- -e 's;$${srcdir}/stabsread.c;-I$${BFD_DIR} &;' \
- -e 's;$${srcdir}/dwarfread.c;-I$${BFD_DIR} &;' \
- -e 's;$${srcdir}/elfread.c;-I$${BFD_DIR} &;' \
- -e 's;$${srcdir}/mipsread.c;-I$${BFD_DIR} &;' \
- -e 's;$${srcdir}/coffread.c;-I$${BFD_DIR} &;' \
- -e 's;$${srcdir}/dbxread.c;-I$${BFD_DIR} &;' \
+ -e 's;$${srcdir}/xcoffread.c;-I$${BFD_SRC_DIR} -I$${BFD_OBJ_DIR} &;' \
+ -e 's;$${srcdir}/stabsread.c;-I$${BFD_SRC_DIR} -I$${BFD_OBJ_DIR} &;' \
+ -e 's;$${srcdir}/dwarfread.c;-I$${BFD_SRC_DIR} -I$${BFD_OBJ_DIR} &;' \
+ -e 's;$${srcdir}/elfread.c;-I$${BFD_SRC_DIR} -I$${BFD_OBJ_DIR} &;' \
+ -e 's;$${srcdir}/mipsread.c;-I$${BFD_SRC_DIR} -I$${BFD_OBJ_DIR} &;' \
+ -e 's;$${srcdir}/coffread.c;-I$${BFD_SRC_DIR} -I$${BFD_OBJ_DIR} &;' \
+ -e 's;$${srcdir}/dbxread.c;-I$${BFD_SRC_DIR} -I$${BFD_OBJ_DIR} &;' \
-e 's;$${srcdir}/main.c;-I$${READLINE_DIR} &;' \
-e ': end' \
>depend.tm4;
# of files to be checked for dependencies.
update-depend: update-alldeps force_update
../configure none -norecursion
+ (cd ../bfd; ../configure sun4 -norecursion; rm -f stmp-bfd.h)
+ (cd ../bfd; $(MAKE) $(MFLAGS) bfd.h)
rm -f depend
$(MAKE) $(MFLAGS) depend
rm -f gdb core make.log
rm -f gdb[0-9]
-distclean: clean c-exp.tab.c m2-exp.tab.c ch-exp.tab.c TAGS
+# This used to depend on c-exp.tab.c m2-exp.tab.c ch-exp.tab.c TAGS
+# I believe this is wrong; the makefile standards for distclean just
+# describe removing files; the only sort of "re-create a distribution"
+# functionality described is if the distributed files are unmodified.
+distclean: clean
@$(MAKE) $(FLAGS_TO_PASS) DO=distclean "DODIRS=$(SUBDIRS)" subdir_do
- rm -f tm.h xm.h config.status
+ rm -f nm.h tm.h xm.h config.status
rm -f y.output yacc.acts yacc.tmp
rm -f ${TESTS} Makefile depend
realclean: clean
@$(MAKE) $(FLAGS_TO_PASS) DO=realclean "DODIRS=$(SUBDIRS)" subdir_do
rm -f c-exp.tab.c m2-exp.tab.c ch-exp.tab.c TAGS
- rm -f tm.h xm.h config.status
- rm -f Makefile depend
+ rm -f nm.h tm.h xm.h config.status
+ rm -f y.output yacc.acts yacc.tmp
+ rm -f ${TESTS} Makefile depend
STAGESTUFF=${OBS} ${TSOBS} ${NTSOBS} ${ADD_FILES} init.c init.o version.c gdb
subdir_do: force
@for i in $(DODIRS); do \
- if [ -d ./$$i ] ; then \
+ if [ -f ./$$i/Makefile ] ; then \
if (cd ./$$i; \
$(MAKE) $(FLAGS_TO_PASS) $(DO)) ; then true ; \
else exit 1 ; fi ; \
version.c: Makefile
echo 'char *version = "$(VERSION)";' >version.c
+ echo 'char *host_canonical = "$(host_canonical)";' >> version.c
+ echo 'char *target_canonical = "$(target_canonical)";' >> version.c
# c-exp.tab.c is generated in target dir from c-exp.y if it doesn't exist
# in srcdir, then compiled in target dir to c-exp.tab.o.
-e '/include.*malloc.h/d' \
-e 's/malloc/xmalloc/g' \
-e 's/realloc/xrealloc/g' \
- < y.tab.c > ././c-exp.tab.c
+ < y.tab.c > c-exp.new
-rm y.tab.c
+ mv c-exp.new ././c-exp.tab.c
# ch-exp.tab.c is generated in target dir from ch-exp.y if it doesn't exist
# in srcdir, then compiled in target dir to ch-exp.tab.o.
-e '/include.*malloc.h/d' \
-e 's/malloc/xmalloc/g' \
-e 's/realloc/xrealloc/g' \
- < y.tab.c > ././ch-exp.tab.c
+ < y.tab.c > ch-exp.new
-rm y.tab.c
+ mv ch-exp.new ././ch-exp.tab.c
# m2-exp.tab.c is generated in target dir from m2-exp.y if it doesn't exist
# in srcdir, then compiled in target dir to m2-exp.tab.o.
-e '/include.*malloc.h/d' \
-e 's/malloc/xmalloc/g' \
-e 's/realloc/xrealloc/g' \
- < y.tab.c > ././m2-exp.tab.c
+ < y.tab.c > m2-exp.new
-rm y.tab.c
+ mv m2-exp.new ././m2-exp.tab.c
-# Used on HP-PA native.
-# This rule fails to get automatically generated in depend because gcc -MM
-# ends up trying to include ../bfd/sysdep.h, which does not exist in an
-# unconfigured BFD directory, and the resulting error suppresses the
-# output of dependency information. For now, just punt. (FIXME)
-paread.o: ${srcdir}/paread.c
- ${CC} -c ${INTERNAL_CFLAGS} -I$(BFD_DIR) ${srcdir}/paread.c
-# Used on RS6000 native.
-# This rule fails to get automatically generated in depend if
-# sys/ldr.h does not exist. (FIXME)
-xcoffexec.o: ${srcdir}/xcoffexec.c
- ${CC} -c ${INTERNAL_CFLAGS} -I${BFD_DIR} ${srcdir}/xcoffexec.c
+# These files are updated atomically, so make never has to remove them
+.PRECIOUS: m2-exp.tab.c ch-exp.tab.c c-exp.tab.c
lint: $(LINTFILES)
$(LINT) $(INCLUDE_CFLAGS) $(LINTFLAGS) $(LINTFILES) \