Hi,
I am using make(1) to build a simple project; and I would like to put the object files into a dedicated directory, say ./x86/. From reading the man page on make(1), I figure that
Here is my attempt (general review about this Makefile is appreciated!)
When I create the directory x86 and run
I interpret the error messages as follows: Make chdir's into x86/, but cannot find the source files anymore.
What am I missing?
Best,
Holger
I am using make(1) to build a simple project; and I would like to put the object files into a dedicated directory, say ./x86/. From reading the man page on make(1), I figure that
.OBJDIR
should be the way to go.Here is my attempt (general review about this Makefile is appreciated!)
Code:
.SUFFIXES: .o .c
.c.o:
${CC} -g ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
SRCS=parser.c string_list.c items.c item_hooks.c rooms.c \
room_hooks.c game_state.c messages.c command_proc.c \
test_parser.c main.c
OBJS=${SRCS:S/.c/.o/g}
# This should put the .o files into a "x86" directory.
.OBJDIR: x86
all: depend myprogram
myprogram: ${OBJS}
$(CC) -o ${.TARGET} ${OBJS}
depend: ${SRCS} main.c
mkdep ${CFLAGS} ${SRCS}
When I create the directory x86 and run
make
, I get the following:
Code:
mkdep -O2 -pipe parser.c string_list.c items.c item_hooks.c rooms.c room_hooks.c game_state.c messages.c command_proc.c test_parser.c main.c
cc: error: no such file or directory: 'parser.c'
cc: error: no such file or directory: 'string_list.c'
cc: error: no such file or directory: 'items.c'
cc: error: no such file or directory: 'item_hooks.c'
cc: error: no such file or directory: 'rooms.c'
cc: error: no such file or directory: 'room_hooks.c'
cc: error: no such file or directory: 'game_state.c'
cc: error: no such file or directory: 'messages.c'
cc: error: no such file or directory: 'command_proc.c'
cc: error: no such file or directory: 'test_parser.c'
cc: error: no such file or directory: 'main.c'
cc: error: no input files
mkdep: compile failed
*** Error code 1
I interpret the error messages as follows: Make chdir's into x86/, but cannot find the source files anymore.
What am I missing?
Best,
Holger