Mail Archives: djgpp/2001/12/15/11:51:12
Please reply also directly to me, thanks
Hello All,
I think it's quite basic, but have a look!
I've got the following problem: i have different sourcefiles in different
subdirectories, i want to compile them and add them to an archive but i
want all object files to be created in a single object directory.
My makefile-attempt looks like this:
###
OBJPATH = ./obj/
DEVPATH = ./dev/
HLPPATH = ./helper/
SNDPATH = ./sound/
OBJECTS = blaster.o pic.o pit.o wrapper.o irq.o stdhlp.o\
soundsys.o
CFLAGS =
CC = gcc
### Test Lib to be created
alpha.a : $(OBJPATH)$(OBJECTS)
ar -rvs alpha.a $(OBJPATH)$(OBJECTS)
$(OBJPATH)%.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
###
It is clear to me that this can't work the dependency of the last rule
would need to have the correct pathes set, this would mean that i have to
rewrite the rule for every subdirectory, but there should be a more clever
way of doing this.
Can i use macros or do you have any other ideas how to do this?
Many thanks in advance,
Martin
- Raw text -