![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Makefile help | tantric | High Level Programming | 4 | 04-13-2007 01:35 AM |
| about the makefile | ligerdave | High Level Programming | 2 | 01-31-2006 01:21 AM |
| makefile | scmay | UNIX for Dummies Questions & Answers | 4 | 06-30-2005 02:39 AM |
| makefile | ECBROWN | UNIX for Dummies Questions & Answers | 4 | 02-17-2005 12:01 PM |
| makefile | raagbansal | UNIX for Advanced & Expert Users | 1 | 12-22-2004 09:59 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
makefile substitution help
This is driving me crazy. I'm trying to automate some things in my makefile and I'm running into a substitution issue.
I'm trying to automatically create object directories if they don't already exist based on the listed source files found in the $(SRCARM) variable. SRCARM = dir1/file1.c \ dir2/file2.c \ dir3/file3.c \ main.c COBJARM = $(SRCARM:%.c=$(OBJDIR)/%.o) which results in: COBJARM = output/dir1/file1.o \ output/dir2/file2.o \ output/dir3/file3.o \ output/main.o These two work, giving me the source and object lists. Now to get all objects' directories so I can create them if they don't already exist. I'd like to create the following: COBJARMDIR = output/dir1 \ output/dir2 \ output/dir3 \ output So I try this: COBJARMDIRS = $(COBJARM:%/=%) Which doesn't work. I don't know if I was expecting it to match the first or last /. I just expected it to do something. I tried escaping the slash as well. All I get is the same list of object files. It appears you have to match the entire end of the string to get the substitution to work. For example: COBJARMDIRS = $(COBJARM:%ain.o=%) results in: COBJARMDIRS = output/dir1/file1.o \ output/dir2/file2.o \ output/dir3/file3.o \ output/m.x but this: COBJARMDIRS = $(COBJARM:%main=%) doesn't replace anything: COBJARMDIRS = output/dir1/file1.o \ output/dir2/file2.o \ output/dir3/file3.o \ output/main.o Sorry for the long winded post. I've just been working on this for 2 hours and I'm getting frustrated. Does anyone know how to do this? Is this even possible? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|