help-make
[Top][All Lists]
Advanced

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

Why does `make' think Nothing to be done for `all' for my script?


From: PRC
Subject: Why does `make' think Nothing to be done for `all' for my script?
Date: Fri, 21 Dec 2007 14:28:57 +0800

This is my Makefile:
----------------------------------------------------------------
CROSS_PREFIX = mips-elf-

CC        = $(CROSS_PREFIX)gcc
LD        = $(CROSS_PREFIX)ld
OBJCOPY   = $(CROSS_PREFIX)objcopy
OBJDUMP   = $(CROSS_PREFIX)objdump

SRCDIR = src/a src/b src/c

VPATH = $(SRCDIR)

CC_OPTS =

SRC_C  = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.c))
SRC_S  = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.S))
SRC    = $(SRC_C) $(SRC_S)

OBJ_C  = $(foreach file, $(notdir $(patsubst %.c, %.o, $(SRC_C))), $(file) )
OBJ_S  = $(foreach file, $(notdir $(patsubst %.S, %.o, $(SRC_S))), $(file) )
OBJ    = $(OBJ_C) $(OBJ_S)

#TARGET = AAXX.a

.PHONY : all clean

all: $(TARGET)

$(TARGET): $(OBJ)
        mips-elf-ar rcv $@ $(OBJ)

%.o: %.c 
        $(CC) $(CC_OPTS) -c -o $@ $<

%.o: %.S
        $(CC) $(CC_OPTS_A) -c -o $@ $<

clean:
        rm -f $(TARGET) *.o
        
TARGET = AAXX.a
----------------------------------------------------------------

And I run `make'
$make
make: Nothing to be done for `all'.

My expected target AAXX.a is not produced. I think `make' resolve the variable 
TARGET as null when it checks the target `all', so that it thinks nothing to be 
done for `all'.

Must I place the variable TARGET assignment before the target `all' in the 
Makefile?





reply via email to

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