help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Nested make?


From: Nikos Balkanas
Subject: Nested make?
Date: Mon, 3 Jan 2005 01:20:52 +0200

Hello,
 
I have a small problem with make. I try to process differently the same source files (%.c) using wildcards and a different argument to make (make asm). The solution that I have is scripted and contrary to make philosophy, inasmuch all the source files are remade not only the ones changed since last time:
 
ASM=nasm
LD=ld
INC=.
ASMFLAGS=-f elf -g
ASMFLAGS=-f elf
LDFLAGS=-s
CFLAGS=-g -W -Wall
CFLAGS=-W -Wall -O6 -fomit-frame-pointer -mcpu=pentiumpro -I${INC}
SRC="" *.asm)
SRC:=${SRC} $(wildcard *.S)
SRC:=${SRC} $(wildcard [^n]*.c)
EXEC=$(basename ${SRC})
OBJ=$(addsuffix .o,${EXEC})
ASMSRC=$(wildcard *.c)
 
all:     ${EXEC}
         strip ${EXEC}
 
clean: 
         rm -f ${OBJ}
         rm -f ${EXEC}
         rm -f *core
 
%:     %.asm 
         ${ASM} ${ASMFLAGS} -o address@hidden $<
         ${LD} ${LDFLAGS} -o $@ address@hidden
         rm -f address@hidden
 
%:     %.S 
         ${ASM} ${ASMFLAGS} -o address@hidden $<
         ${LD} ${LDFLAGS} -o $@ address@hidden
         rm -f address@hidden
 
asm: ${ASMSRC}
         @for i in ${ASMSRC}; do     \
         echo "${CC} ${CFLAGS} -S -fverbose-asm $$i"; \
         ${CC} ${CFLAGS} -S -fverbose-asm $$i;  \
         done
 
%:     %.c
         ${CC} ${CFLAGS} $< -o $@
Instead I am looking for smt else (nested example - not working):
 
asm:    %:    %.c
            ${CC} ${CFLAGS} -S -fverbose-asm $<
 
Or something similar.
 
Any suggestions welcome.
 
Thanks,
Nikos

reply via email to

[Prev in Thread] Current Thread [Next in Thread]