1# Copyright (c) 2004,  Theodore A. Roth
2# Copyright (c) 2005, 2008  Anatoly Sokolov
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are met:
7#
8# * Redistributions of source code must retain the above copyright
9#   notice, this list of conditions and the following disclaimer.
10# * Redistributions in binary form must reproduce the above copyright
11#   notice, this list of conditions and the following disclaimer in
12#   the documentation and/or other materials provided with the
13#   distribution.
14# * Neither the name of the copyright holders nor the names of
15#   contributors may be used to endorse or promote products derived
16#   from this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28# POSSIBILITY OF SUCH DAMAGE.
29#
30
31AVR_TARGET          = at90pwm81
32if HAS_DEV_LIB
33if HAS_GCC_5_1
34# avr-gcc 5.1.0 expects crt file as crt1.o and
35# device library in dev directory
36AVR_TARGET_CRT      = crt1.o
37AVR_INSTALL_DIR     = dev/at90pwm81
38else
39# avr-gcc > 5.1.0 expects crt file as crt<device name>.o and
40# device library in multi-lib directory itself
41AVR_TARGET_CRT      = crtat90pwm81.o
42AVR_INSTALL_DIR     = avr4
43endif
44else
45AVR_TARGET_CRT      = crt90pwm81.o
46AVR_INSTALL_DIR     = avr4
47endif
48AVR_TARGET_DEFS     =
49AVR_TARGET_CFLAGS   = -mcall-prologues -Os
50AVR_TARGET_ASFLAGS  =
51
52VPATH = $(top_srcdir)/crt1:$(top_srcdir)/libc/misc
53
54if HAS_DEV_LIB
55include $(top_srcdir)/libc/misc/Rules.am
56endif
57
58if HAS_at90pwm81
59
60AM_CPPFLAGS = -I$(top_srcdir)/common -I$(top_srcdir)/include -I$(top_builddir)/include
61
62AVRLIB_CFLAGS = @CDEBUG@ -Wall -W -Wstrict-prototypes -mmcu=$(AVR_TARGET) $(AVR_TARGET_DEFS) $(AVR_TARGET_CFLAGS)
63
64AVRLIB_ASFLAGS = -x assembler-with-cpp @ASDEBUG@ -mmcu=$(AVR_TARGET) $(AVR_TARGET_DEFS) -DIOSYMFILE=\"iosym/$(AVR_TARGET).S\" $(AVR_TARGET_ASFLAGS)
65
66AM_CFLAGS = $(AVRLIB_CFLAGS)
67AM_CCASFLAGS = $(AM_CPPFLAGS) $(AVRLIB_ASFLAGS)
68
69
70__install_dir = $(prefix)/avr/lib/$(AVR_INSTALL_DIR)
71
72avrdir = $(__install_dir)
73avrlibdir = $(__install_dir)
74
75noinst_LIBRARIES = libcrt.a
76nodist_libcrt_a_SOURCES = gcrt1.S
77
78if HAS_DEV_LIB
79if HAS_GCC_5_1
80# avr-gcc 5.1.0 expects device library as libdev.a
81avr_LIBRARIES = libdev.a
82nodist_libdev_a_SOURCES = $(eeprom_asm_sources)
83else
84# avr-gcc > 5.1.0 expects device library as lib<device name>.a
85avr_LIBRARIES = libat90pwm81.a
86nodist_libat90pwm81_a_SOURCES = $(eeprom_asm_sources)
87endif
88endif
89
90avr_DATA = $(AVR_TARGET_CRT)
91
92$(AVR_TARGET_CRT): gcrt1.o
93	rm -f $@
94	ln $< $@ || cp $< $@
95
96else
97
98echo all distdir install installdirs clean distclean uninstall check:
99
100endif
101