1 | ###############################################################################
|
---|
2 | # Makefile for the project test_ethernet
|
---|
3 | ###############################################################################
|
---|
4 |
|
---|
5 | ## General Flags
|
---|
6 | PROJECT = test_ethernet
|
---|
7 | MCU = atmega32
|
---|
8 | TARGET = test_ethernet.elf
|
---|
9 | CC = avr-gcc
|
---|
10 |
|
---|
11 | CPP = avr-g++
|
---|
12 |
|
---|
13 | ## Options common to compile, link and assembly rules
|
---|
14 | COMMON = -mmcu=$(MCU)
|
---|
15 |
|
---|
16 | ## Compile options common for all C compilation units.
|
---|
17 | CFLAGS = $(COMMON)
|
---|
18 | CFLAGS += -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
|
---|
19 | CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d
|
---|
20 |
|
---|
21 | ## Assembly specific flags
|
---|
22 | ASMFLAGS = $(COMMON)
|
---|
23 | ASMFLAGS += $(CFLAGS)
|
---|
24 | ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2
|
---|
25 |
|
---|
26 | ## Linker flags
|
---|
27 | LDFLAGS = $(COMMON)
|
---|
28 | LDFLAGS += -Wl,-Map=test_ethernet.map
|
---|
29 |
|
---|
30 |
|
---|
31 | ## Intel Hex file production flags
|
---|
32 | HEX_FLASH_FLAGS = -R .eeprom -R .fuse -R .lock -R .signature
|
---|
33 |
|
---|
34 | HEX_EEPROM_FLAGS = -j .eeprom
|
---|
35 | HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
|
---|
36 | HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings
|
---|
37 |
|
---|
38 |
|
---|
39 | ## Objects that must be built in order to link
|
---|
40 | OBJECTS = FSC_test.o ad7719_adc.o application.o atmega_adc.o muxer_fsc.o num_conversion.o output.o parser.o spi_master.o usart.o w5100_spi_interface.o
|
---|
41 |
|
---|
42 | ## Objects explicitly added by the user
|
---|
43 | LINKONLYOBJECTS =
|
---|
44 |
|
---|
45 | ## Build
|
---|
46 | all: $(TARGET) test_ethernet.hex test_ethernet.eep test_ethernet.lss## Compile
|
---|
47 | FSC_test.o: ../../../src/FSC_test.c
|
---|
48 | $(CC) $(INCLUDES) $(CFLAGS) -c $<
|
---|
49 |
|
---|
50 | ad7719_adc.o: ../../../src/ad7719_adc.c
|
---|
51 | $(CC) $(INCLUDES) $(CFLAGS) -c $<
|
---|
52 |
|
---|
53 | application.o: ../../../src/application.c
|
---|
54 | $(CC) $(INCLUDES) $(CFLAGS) -c $<
|
---|
55 |
|
---|
56 | atmega_adc.o: ../../../src/atmega_adc.c
|
---|
57 | $(CC) $(INCLUDES) $(CFLAGS) -c $<
|
---|
58 |
|
---|
59 | muxer_fsc.o: ../../../src/muxer_fsc.c
|
---|
60 | $(CC) $(INCLUDES) $(CFLAGS) -c $<
|
---|
61 |
|
---|
62 | num_conversion.o: ../../../src/num_conversion.c
|
---|
63 | $(CC) $(INCLUDES) $(CFLAGS) -c $<
|
---|
64 |
|
---|
65 | output.o: ../../../src/output.c
|
---|
66 | $(CC) $(INCLUDES) $(CFLAGS) -c $<
|
---|
67 |
|
---|
68 | parser.o: ../../../src/parser.c
|
---|
69 | $(CC) $(INCLUDES) $(CFLAGS) -c $<
|
---|
70 |
|
---|
71 | spi_master.o: ../../../src/spi_master.c
|
---|
72 | $(CC) $(INCLUDES) $(CFLAGS) -c $<
|
---|
73 |
|
---|
74 | usart.o: ../../../src/usart.c
|
---|
75 | $(CC) $(INCLUDES) $(CFLAGS) -c $<
|
---|
76 |
|
---|
77 | w5100_spi_interface.o: ../../../src/w5100_spi_interface.c
|
---|
78 | $(CC) $(INCLUDES) $(CFLAGS) -c $<
|
---|
79 |
|
---|
80 | ##Link
|
---|
81 | $(TARGET): $(OBJECTS)
|
---|
82 | $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)
|
---|
83 |
|
---|
84 | %.hex: $(TARGET)
|
---|
85 | avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@
|
---|
86 |
|
---|
87 | %.eep: $(TARGET)
|
---|
88 | -avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0
|
---|
89 |
|
---|
90 | %.lss: $(TARGET)
|
---|
91 | avr-objdump -h -S $< > $@
|
---|
92 |
|
---|
93 | ## Clean target
|
---|
94 | .PHONY: clean
|
---|
95 | clean:
|
---|
96 | -rm -rf $(OBJECTS) test_ethernet.elf dep/* test_ethernet.hex test_ethernet.eep test_ethernet.lss test_ethernet.map
|
---|
97 |
|
---|
98 |
|
---|
99 | ## Other dependencies
|
---|
100 | -include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
|
---|
101 |
|
---|