Hallo, martin,

hmmmm - das makefile ist (bei meinen bisherigen C Programmen, meine C-Erfahrung ist etwa drei, vier Monate alt, aber es gibt das eine oder andere lauffähige Controllerprogramm von mir) etwas, das der Compiler "hervorzaubert" - sprich - ich bin darin total unbewandert. Das gehört (auch noch) zu den Dingen die ich nicht kann.

Sprich - ich habe am makefile GARNIX gemacht.
Code:
###############################################################################
# Makefile for the project test_I2Cs-1
###############################################################################

## General Flags
PROJECT = test_I2Cs-1
MCU = atmega168
TARGET = test_I2Cs-1.elf
CC = avr-gcc.exe

## Options common to compile, link and assembly rules
COMMON = -mmcu=$(MCU)

## Compile options common for all C compilation units.
CFLAGS = $(COMMON)
CFLAGS += -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d 

## Assembly specific flags
ASMFLAGS = $(COMMON)
ASMFLAGS += $(CFLAGS)
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2

## Linker flags
LDFLAGS = $(COMMON)
LDFLAGS +=  -Wl,-Map=test_I2Cs-1.map


## Intel Hex file production flags
HEX_FLASH_FLAGS = -R .eeprom

HEX_EEPROM_FLAGS = -j .eeprom
HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings


## Objects that must be built in order to link
OBJECTS = test_I2Cs-1.o 

## Objects explicitly added by the user
LINKONLYOBJECTS = 

## Build
all: $(TARGET) test_I2Cs-1.hex test_I2Cs-1.eep test_I2Cs-1.lss size

## Compile
test_I2Cs-1.o: ../test_I2Cs-1.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

##Link
$(TARGET): $(OBJECTS)
	 $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)

%.hex: $(TARGET)
	avr-objcopy -O ihex $(HEX_FLASH_FLAGS)  $< $@

%.eep: $(TARGET)
	-avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0

%.lss: $(TARGET)
	avr-objdump -h -S $< > $@

size: ${TARGET}
	@echo
	@avr-size -C --mcu=${MCU} ${TARGET}

## Clean target
.PHONY: clean
clean:
	-rm -rf $(OBJECTS) test_I2Cs-1.elf dep/* test_I2Cs-1.hex test_I2Cs-1.eep test_I2Cs-1.lss test_I2Cs-1.map


## Other dependencies
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
Leider. Ich habe etwas gepfuscht und das "TWI_Slave.c" als "#include" eingesetzt. Da liegt wohl ein Hund begraben. Und jetzt kommt bei (m)/Deinem Slave-programm wieder dieser error: "../TWI_slave.h:35: error: redefinition of 'union TWI_statusReg' ".
Code:
Build started 21.3.2008 at 17:27:18
avr-gcc.exe  -mmcu=atmega168 -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT test_I2Cs-1.o -MF dep/test_I2Cs-1.o.d  -c  ../test_I2Cs-1.c
In file included from ../TWI_Slave.c:27,
                 from ../test_I2Cs-1.c:32:
../TWI_slave.h:35: error: redefinition of 'union TWI_statusReg'
../test_I2Cs-1.c:53: warning: return type of 'main' is not 'int'
../test_I2Cs-1.c: In function 'main':
../test_I2Cs-1.c:67: warning: implicit declaration of function '__enable_interrupt'
../test_I2Cs-1.c:114: warning: implicit declaration of function '__no_operation'
../test_I2Cs-1.c:55: warning: unused variable 'temp'
make: *** [test_I2Cs-1.o] Error 1
Build failed with 1 errors and 4 warnings...
Ich muss mich wohl mit dem makefile beschäftigen .