PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Makefile:531: *** multiple target patterns. Stop.



grind
10.01.2007, 19:34
Hi!
Nachdem ich endlich MFile benutzen konnte hab ich alles eingestellt und folgenden Fehler bekommen:

Makefile:531: *** multiple target patterns. Stop.


In Zeile 531 steht ".PRECIOUS : $(OBJ)".

Weiss jemand wass da falsch is? Google hilft mir leider auch nich weiter :(

SprinterSB
10.01.2007, 19:54
Zählst du in OBJ ein Objekt mehrfach auf?

grind
10.01.2007, 20:22
Also ich kenn mich noch nich wirklich aus...

Ich nehme mal an du meinst das Makefile? Also wie gesagt des is mit MFile erstellt und ich weiss bei den wenigsten Sachen wofür die da sinn.
Aber ich nehme an du meinst das:

OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)

?

SprinterSB
10.01.2007, 20:27
*argl*

sorry, da muss ich passen. Da geht es dann weiter mit SRC, CPPSRC, ASRC, OBJDIR. Und dann geht es es weiter mit...

Generatoren sind ja ganz fein...falls sie funktionieren ;-)

grind
10.01.2007, 20:45
Schade dass du mir nich helfen kannst... Aber ich dank dir trotzdem vielmals!

Vielleicht kennt ja sonst jemand ne Lösung für mein problem?!

SprinterSB
10.01.2007, 21:15
Der String, zu dem OBJ im Ende auflöst, scheint Mehrfacheinträge zu haben. Das könnte zB sein, wenn du sowohl foo.c als auch foo.S resp. foo.cpp als Quellen hast. Evtl. ist der Fehler auch veruhrsacht duch seltsame Zeichen in Datei- oder Verzeichnisnamen (backslash, space, umlauts, ligatur, ...)

grind
11.01.2007, 10:49
Kann mir vielleicht jemand ein minimales Makefile schicken des ich einfach nur anpassen muss? Bisschen Daten eintragen is ja kein Problem...

Oder brauch ich wirklich über 500 Zeilen in meinem Makefile?

SprinterSB
11.01.2007, 11:54
Das Makefile habe ich in einem Unterverzeichnis foo/obj und die Quellen dann in foo, also keine komplizierte Projektstruktur. Wenn man Quellen und Objekte im gleichen Verzeichnis mischen will, wird's noch einfacher.


## Makefile targets

# all make hex and elf files
# clean remove intermediate and binary files
# reset reset the target
# burn upload program (firmware) to target
# burn-all upload program (firmware) and persistent data (EEPROM) to target

# Generated files in the directory
# *.s: Assembler output of gcc (GNU AVR assembly as ASCII)
# *.o: Objects (elf32-avr)
# *.elf: final binary (elf32-avr)
# *.hex: final binary (Intel HEX)
# *.lst: Disassembly of *.elf (ASCII)
# *.map: map file (location info, ASCII)

# The project's base name to name hex- and elf-files and such
PRG = eBook

# C sources that make up the project
SRC = main.c vfd-put.c vfd.c ebook.c taster.c main.c timer.c

# we run on an AVR ATmega8
MCU_TARGET = atmega8

# You must change the Port and Progger to fit your hardware.
# siprog3 is home brew
AVRDUDE = avrdude.exe -p $(MCU_TARGET) -P com1 -c siprog3

OPTIMIZE = -Os
INCLUDES = -I../include

DEFS = -DF_CPU=8000000

CC = avr-gcc -mmcu=$(MCU_TARGET)
LD = $(CC)
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump

# Targets dealing with C sources
.PHONY: all size lst text eeprom depend

# clean targets
.PHONY: clean

# Targets that use avrdude
.PHONY: reset burn burn-all

CFLAGS = -Wall $(OPTIMIZE) $(DEFS) $(INCLUDES) -Winline -fno-keep-inline-functions
LDFLAGS = -Wl,-Map,$(PRG).map -Wl,-section-start=.eeprom=0x810001
ASMFLAGS = -dp -save-temps -fverbose-asm

# object and assembler files. we build *.o out of *.s (not *.c)
OBJ = $(patsubst %.c, %.o, $(SRC))
ASM = $(patsubst %.c, %.s, $(SRC))

all: depend $(ASM) $(PRG).elf lst text eeprom

depend:
$(CC) -MM $(addprefix ../, $(SRC)) -mmcu=$(MCU_TARGET) $(DEFS) $(INCLUDES) |\
sed -e 's/\.o:/.s:/' > .depend

size:
avr-size -x $(OBJ)
@echo AVR $(MCU_TARGET) Memory Usage:
@avr-size -C --mcu=$(MCU_TARGET) $(PRG).elf | grep -E '^(Data)|(Pro)'

$(PRG).elf: $(OBJ)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)

-include .depend

%.s: ../%.c Makefile
$(CC) -S $< -o $@ $(ASMFLAGS) $(CFLAGS)

%.o: %.s
$(CC) -x assembler $< -c -o $@

# Rules to clean up

clean:
rm -f .depend $(wildcard *.o *.s *.i *.map *.lst *.elf *.hex *.map *~ ../*~)

# Rules to generate disassembly

lst: $(PRG).lst

%.lst: %.elf
$(OBJDUMP) -h -S -j .data -j .eeprom -j .text $< > $@

# Rules for building the .text rom images

text: $(PRG).hex

%.hex: %.elf
$(OBJCOPY) -j .text -j .data -O ihex $< $@

# Rules for building the .eeprom rom images

eeprom: $(PRG)_eeprom.hex

%_eeprom.hex: %.elf
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=1 -O ihex $< $@

# Rules with avrdude
reset:
$(AVRDUDE)

burn:
$(AVRDUDE) -V -U flash:w:"$(PRG).hex"

burn-all:
$(AVRDUDE) -V -U flash:w:"$(PRG).hex" -U eeprom:w:"$(PRG)_eeprom.hex"


Bei Fragen fragen. Wichtig ist, daß die Einrückungen TABs sind. Ein gscheiter Editor (zB emacs) sollte das erkennen bzw. anmeckern, falls nicht.

grind
11.01.2007, 12:01
Sitz grad in der Arbeit und kanns deswegen nich testen aber du bist mein Held! ;)

Danke schonmal vielmals!!!