Archived

This topic is now archived and is closed to further replies.

JeroMiya

makefile inference rule problems

Recommended Posts

JeroMiya    122
I''m trying to write a makefile that uses inference rules to compile .o files from their associated .cpp files, as well as auto-generate other depends. However, it is not recognizing that the target is dependent on the object files, which are dependant on the .cpp files and the makedepend .h files. Here is a script of my trying to use my makefile:
Script started on Mon Oct 21 14:57:11 2002
zlin% cat Makefile

CFLAGS = -O3 -Wall
CC = g++
####### Files

SOURCES = main.cpp mainFuncs.cpp error.cpp map.cpp mapStack.cpp MapQueue.cpp utils.cpp
OBJECTS = main.o mainFuncs.o error.o map.o mapStack.o MapQueue.o utils.o
TARGET  = mywidget#

####### Implicit rules
.SUFFIXES: .cpp .h
%.o : %.cpp
	${CC} ${CFLAGS} -c $*.cpp

####### Build rules
all: $(TARGET)

$(TARGET): ${OBJECTS}
	echo $(OBJECTS)
	$(CC) $(OBJECTS) -o $(TARGET)

depend:
	makedepend -fMakefile -- $(CFLAGS) -- $(SOURCES)
showfiles:
	@echo $(HEADERS) $(SOURCES) Makefile

clean:
	rm -f *.o *.bak *~ *% #*
	rm -f $(TARGET)

# DO NOT DELETE THIS LINE -- make depend depends on it.

main.o: /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h
main.o: /usr/include/gnu/stubs.h
main.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h
main.o: /usr/include/bits/types.h /usr/include/libio.h
main.o: /usr/include/_G_config.h /usr/include/wchar.h
main.o: /usr/include/bits/wchar.h /usr/include/gconv.h
main.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h
main.o: /usr/include/bits/stdio_lim.h error.h /usr/include/string.h utils.h
main.o: main.h map.h GlobalSettings.h /usr/include/limits.h
main.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h mapStack.h
main.o: /usr/include/stdlib.h MapQueue.h
mainFuncs.o: main.h /usr/include/string.h /usr/include/features.h
mainFuncs.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
mainFuncs.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h utils.h
mainFuncs.o: /usr/include/stdio.h /usr/include/bits/types.h
mainFuncs.o: /usr/include/libio.h /usr/include/_G_config.h
mainFuncs.o: /usr/include/wchar.h /usr/include/bits/wchar.h
mainFuncs.o: /usr/include/gconv.h
mainFuncs.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h
mainFuncs.o: /usr/include/bits/stdio_lim.h error.h map.h GlobalSettings.h
mainFuncs.o: /usr/include/limits.h
mainFuncs.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h
mainFuncs.o: mapStack.h /usr/include/stdlib.h MapQueue.h
error.o: error.h /usr/include/string.h /usr/include/features.h
error.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
error.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h utils.h
error.o: /usr/include/stdio.h /usr/include/bits/types.h /usr/include/libio.h
error.o: /usr/include/_G_config.h /usr/include/wchar.h
error.o: /usr/include/bits/wchar.h /usr/include/gconv.h
error.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h
error.o: /usr/include/bits/stdio_lim.h
map.o: map.h error.h /usr/include/string.h /usr/include/features.h
map.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
map.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h utils.h
map.o: /usr/include/stdio.h /usr/include/bits/types.h /usr/include/libio.h
map.o: /usr/include/_G_config.h /usr/include/wchar.h
map.o: /usr/include/bits/wchar.h /usr/include/gconv.h
map.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h
map.o: /usr/include/bits/stdio_lim.h GlobalSettings.h /usr/include/limits.h
map.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h
mapStack.o: mapStack.h error.h /usr/include/string.h /usr/include/features.h
mapStack.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
mapStack.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h utils.h
mapStack.o: /usr/include/stdio.h /usr/include/bits/types.h
mapStack.o: /usr/include/libio.h /usr/include/_G_config.h
mapStack.o: /usr/include/wchar.h /usr/include/bits/wchar.h
mapStack.o: /usr/include/gconv.h
mapStack.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h
mapStack.o: /usr/include/bits/stdio_lim.h map.h GlobalSettings.h
mapStack.o: /usr/include/limits.h
mapStack.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h
mapStack.o: /usr/include/stdlib.h
MapQueue.o: MapQueue.h error.h /usr/include/string.h /usr/include/features.h
MapQueue.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
MapQueue.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h utils.h
MapQueue.o: /usr/include/stdio.h /usr/include/bits/types.h
MapQueue.o: /usr/include/libio.h /usr/include/_G_config.h
MapQueue.o: /usr/include/wchar.h /usr/include/bits/wchar.h
MapQueue.o: /usr/include/gconv.h
MapQueue.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h
MapQueue.o: /usr/include/bits/stdio_lim.h map.h GlobalSettings.h
MapQueue.o: /usr/include/limits.h
MapQueue.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h
MapQueue.o: /usr/include/stdlib.h
utils.o: utils.h /usr/include/string.h /usr/include/features.h
utils.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
utils.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h
utils.o: /usr/include/stdio.h /usr/include/bits/types.h /usr/include/libio.h
utils.o: /usr/include/_G_config.h /usr/include/wchar.h
utils.o: /usr/include/bits/wchar.h /usr/include/gconv.h
utils.o: /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h
utils.o: /usr/include/bits/stdio_lim.h error.h
zlin% make clean

rm -f *.o *.bak *~ *% #*
rm -f 
zlin% make depend

makedepend -fMakefile -- -O3 -Wall -- main.cpp mainFuncs.cpp error.cpp map.cpp mapStack.cpp MapQueue.cpp utils.cpp
makedepend: warning:  main.cpp, line 1: cannot find include file "iostream"
	not in /usr/local/lib/gcc-include/iostream
	not in /usr/include/iostream
	not in /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/iostream
makedepend: warning:  main.cpp (reading error.h, line 14): cannot find include file "iostream"
	not in /usr/local/lib/gcc-include/iostream
	not in /usr/include/iostream
	not in /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/iostream
makedepend: warning:  main.cpp (reading main.h, line 13): cannot find include file "iostream"
	not in /usr/local/lib/gcc-include/iostream
	not in /usr/include/iostream
	not in /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/iostream
zlin% make all

make: Nothing to be done for `all''.
zlin% make Maze

make: Nothing to be done for `Maze''.
zlin% make main.c[Kcpp

make: Nothing to be done for `main.cpp''.
zlin% make mak[Kin.o

g++ -O3 -Wall -c main.cpp
zlin% make error.o

g++ -O3 -Wall -c error.cpp
zlin% ^D
Use "exit" to leave csh.
zlin% exit
Script done on Mon Oct 21 14:57:45 2002
 

Share this post


Link to post
Share on other sites