Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-26-2004, 10:07 AM   #1
LQ Newbie
Registered: Feb 2004
Posts: 11

Rep: Reputation: 0
make with multiple targets

in several of our projects i need to compile
the same software multiple times with different
defines and for different processortypes.
a simple is this one, it has one common source
but 2 different target processors. the second
target also needs a different define.
my first attempt was this:

PROJ = C101
TARG1 = $(PROJ).hex
TARG2 = $(PROJ)_RJ11.hex

.PHONY : all
.PHONY : clean

all : $(TARG1) $(TARG2)

now i need to declare theese variables different for
each target :

for target1:
MCU = atmega8515
DEFS = -DDEV_SPECIFIC='"../$(PROJ)/dev_specific_cmd.c"'

for target2:
MCU = atmega162
DEFS = -DDEV_SPECIFIC='"../$(PROJ)/dev_specific_cmd_rj11.c"'

also i need to clean up all object and library files before
i compile, because i have different processortypes and also
different code activated via #ifdef ... #endif

how can i accomplish that ? i read a lot of make
documentation today, i just seem stuck ;(
Old 02-26-2004, 12:42 PM   #2
Registered: Sep 2003
Distribution: Slackware 10 w/ Kernel 2.6.8
Posts: 176

Rep: Reputation: 30
PROJ = C101
TARG1 = $(PROJ).hex
TARG2 = $(PROJ)_RJ11.hex
MCU1 = atmega8515
DEFS1 = -DDEV_SPECIFIC='"../$(PROJ)/dev_specific_cmd.c"'
MCU2 = atmega162
DEFS2 = -DDEV_SPECIFIC='"../$(PROJ)/dev_specific_cmd_rj11.c"'

all : clean $(TARG1) $(TARG2)

-rm $(TARG1) $(TARG2) *.o

$(TARG1) :
gcc targ1.cpp -o $(TARG1) $(MCU1) $(DEFS1)

$(TARG2) :
gcc targ2.cpp -o $(TARG2) $(MCU2) $(DEFS2)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
automake and install of multiple targets therf Linux - Software 0 09-14-2005 05:08 PM
makefile targets dand Programming 1 07-11-2005 04:28 PM
tinkering with dkms: make error no targets. Makefile issue? Emmanuel_uk Linux - Newbie 1 06-03-2005 02:26 AM
Adding more targets to Make oulevon Programming 6 02-09-2005 06:11 PM
DoomJuice worm targets M$ LinuxLala General 2 02-10-2004 07:58 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:10 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration