1 | # Makefile for AVR function library development and examples
|
2 | # Author: Pascal Stang
|
3 | #
|
4 | # For those who have never heard of makefiles: a makefile is essentially a
|
5 | # script for compiling your code. Most C/C++ compilers in the world are
|
6 | # command line programs and this is even true of programming environments
|
7 | # which appear to be windows-based (like Microsoft Visual C++). Although
|
8 | # you could use AVR-GCC directly from the command line and try to remember
|
9 | # the compiler options each time, using a makefile keeps you free of this
|
10 | # tedious task and automates the process.
|
11 | #
|
12 | # For those just starting with AVR-GCC and not used to using makefiles,
|
13 | # I've added some extra comments above several of the makefile fields which
|
14 | # you will have to deal with.
|
15 |
|
16 | ########### change this lines according to your project ##################
|
17 | #put the name of the target mcu here (at90s8515, at90s8535, attiny22, atmega603 etc.)
|
18 | # MCU = atmega163
|
19 | # MCU = atmega161
|
20 | # MCU = atmega323
|
21 | # MCU = atmega128
|
22 | MCU = atmega8
|
23 |
|
24 | #put the name of the target file here (without extension)
|
25 | # Your "target" file is your C source file that is at the top level of your code.
|
26 | # In other words, this is the file which contains your main() function.
|
27 |
|
28 | TRG = test
|
29 |
|
30 | #put your C sourcefiles here
|
31 | # Here you must list any C source files which are used by your target file.
|
32 | # They will be compiled in the order you list them, so it's probably best
|
33 | # to list $(TRG).c, your top-level target file, last.
|
34 |
|
35 | SRC = $(TRG).c $(AVRLIB)/rprintf.c $(AVRLIB)/uart.c $(AVRLIB)/buffer.c pckb.c $(AVRLIB)/i2c.c $(AVRLIB)/i2ceeprom.c
|
36 |
|
37 | #put additional assembler source file here
|
38 | # The ASRC line allows you to list files which contain assembly code/routines that
|
39 | # you would like to use from within your C programs. The assembly code must be
|
40 | # written in a special way to be usable as a function from your C code.
|
41 |
|
42 | ASRC =
|
43 |
|
44 | #additional libraries and object files to link
|
45 | # Libraries and object files are collections of functions which have already been
|
46 | # compiled. If you have such files, list them here, and you will be able to use
|
47 | # use the functions they contain in your target program.
|
48 |
|
49 | LIB =
|
50 |
|
51 | #additional includes to compile
|
52 | INC =
|
53 |
|
54 | #assembler flags
|
55 | ASFLAGS = -Wa, -gstabs
|
56 |
|
57 | #compiler flags
|
58 | CPFLAGS = -g -Os -Wall -Wstrict-prototypes -I$(AVRLIB) -Wa,-ahlms=$(<:.c=.lst)
|
59 |
|
60 |
|
61 | #linker flags
|
62 | LDFLAGS = -Wl,-Map=$(TRG).map,--cref
|
63 | LDFLAGS += --no-channge-warnings
|
64 | # LDFLAGS = -Wl,-Map=$(TRG).map,--cref -lm
|
65 |
|
66 |
|
67 |
|
68 | ########### you should not need to change the following line #############
|
69 | include $(AVRLIB)/make/avrproj_make
|
70 |
|
71 | ###### dependecies, add any dependencies you need here ###################
|
72 | # Dependencies tell the compiler which files in your code depend on which
|
73 | # other files. When you change a piece of code, the dependencies allow
|
74 | # the compiler to intelligently figure out which files are affected and
|
75 | # need to be recompiled. You should only list the dependencies of *.o
|
76 | # files. For example: uart.o is the compiled output of uart.c and uart.h
|
77 | # and therefore, uart.o "depends" on uart.c and uart.h. But the code in
|
78 | # uart.c also uses information from global.h, so that file should be listed
|
79 | # in the dependecies too. That way, if you alter global.h, uart.o will be
|
80 | # recompiled to take into account the changes.
|
81 |
|
82 | buffer.o : buffer.c buffer.h
|
83 | uart.o : uart.c uart.h global.h
|
84 | uart2.o : uart2.c uart2.h global.h
|
85 | rprintf.o : rprintf.c rprintf.h
|
86 | a2d.o : a2d.c a2d.h
|
87 | timer.o : timer.c timer.h global.h
|
88 | pulse.o : pulse.c pulse.h timer.h global.h
|
89 | lcd.o : lcd.c lcd.h global.h
|
90 | i2c.o : i2c.c i2c.h global.h
|
91 | spi.o : spi.c spi.h global.h
|
92 | swpwm.o : swpwm.c swpwm.h global.h
|
93 | servo.o : servo.c servo.h global.h
|
94 | swuart.o : swuart.c swuart.h global.h
|
95 | tsip.o : tsip.c tsip.h global.h
|
96 | nmea.o : nmea.c nmea.h global.h
|
97 | vt100.o : vt100.c vt100.h global.h
|
98 | gps.o : gps.c gps.h global.h
|
99 | $(TRG).o : $(TRG).c global.h
|