* device/lib/pic16/Makefile.common.in: add --optimize-df to OPT_FLAGS
[fw/sdcc] / device / lib / pic16 / libio / Makefile
1 #
2 # Makefile - Makefile to build pic16 support libraries
3 #
4 # This file is part of the GNU PIC Library.
5 #
6 # January, 2004
7 # The GNU PIC Library is maintained by,
8 #       Vangelis Rokas <vrokas@otenet.gr>
9 #
10 # $Id$
11 #
12 #
13
14 MCUS    = $(shell cat ../pics.build)
15
16 PROCESSORS      = $(MCUS)
17
18
19 DIRS    = adc i2c usart
20
21 LOBJS   = $(patsubst %,%/*.o,$(DIRS))
22
23 # library name example libio18f8720.lib
24 LIB     = libio18f$(MMCU).lib
25
26 all: build-libraries
27
28 make-target: build-libraries
29
30 build-libraries:
31         for proc in $(PROCESSORS) ; do \
32                 echo "Building libraries for processor pic18f $$proc" ; \
33                 $(MAKE) -C . build-processor-library MMCU=$$proc ;  \
34         done ;
35
36 # Should have externally specified PROC
37 build-processor-library:
38         for dir in $(DIRS) ; do  \
39                 $(MAKE) -C $$dir clean ; \
40                 grep $(MMCU) "$${dir}.ignore" > /dev/null 2>&1 || $(MAKE) -C $$dir build-io-lib MCU=18f$(MMCU); \
41         done;
42         make invoke-gplib
43         mv -v $(LIB) ../bin
44
45 # needed so that make updates the list of .o files correctly...
46 invoke-gplib:
47         gplib -c $(LIB) $(foreach dir,$(DIRS),$(wildcard $(dir)/*.o))
48
49 clean-intermediate:
50         @for dir in $(DIRS) ; do \
51                 $(MAKE) -C $$dir clean-intermediate ; \
52         done ;
53         
54 clean:
55         for dir in $(DIRS) ; do \
56                 $(MAKE) -C $$dir clean; \
57         done ;
58         rm -fv $(LIB)
59
60
61 real-clean: clean
62         find -name *.adb -print | xargs -- rm -fv ;
63         find -name *.p -print | xargs -- rm -fv ;
64         find -name *.d -print | xargs -- rm -fv ;
65         find -name *.dump* -print | xargs -- rm -fv ;
66         
67
68 dep:
69         for dir in $(DIRS) ; do \
70                 $(MAKE) -C $$dir dep; \
71         done