www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/12/15/11:51:12

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Message-Id: <5.0.2.1.2.20011215171259.009e1b40@pop.gmx.net>
X-Sender: martinSteuer AT gmx DOT de@pop.gmx.net
X-Mailer: QUALCOMM Windows Eudora Version 5.0.2
Date: Sat, 15 Dec 2001 17:40:58 +0100
To: djgpp AT delorie DOT com
From: Martin Steuer <martinSteuer AT gmx DOT de>
Subject: Makefile Tip
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019