www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/12/20/12:38:48

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Message-Id: <5.0.2.1.2.20011220182810.009e4700@pop.gmx.net>
X-Sender: martinSteuer AT gmx DOT de@pop.gmx.net
X-Mailer: QUALCOMM Windows Eudora Version 5.0.2
Date: Thu, 20 Dec 2001 18:31:09 +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

I send this message to the list a few days ago, but got no answers, please 
if you can provide me with an example/help how to do that, it would be 
great! Or just tell me if it's offtopic and where to ask...

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