OpenCores
URL https://opencores.org/ocsvn/openarty/openarty/trunk

Subversion Repositories openarty

[/] [openarty/] [trunk/] [sw/] [board/] [Makefile] - Blame information for rev 52

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 31 dgisselq
################################################################################
2
##
3
## Filename:    Makefile
4
##
5
## Project:     OpenArty, an entirely open SoC based upon the Arty platform
6
##
7
## Purpose:
8
##
9
## Creator:     Dan Gisselquist, Ph.D.
10
##              Gisselquist Technology, LLC
11
##
12
################################################################################
13
##
14 52 dgisselq
## Copyright (C) 2016-2017, Gisselquist Technology, LLC
15 31 dgisselq
##
16
## This program is free software (firmware): you can redistribute it and/or
17
## modify it under the terms of  the GNU General Public License as published
18
## by the Free Software Foundation, either version 3 of the License, or (at
19
## your option) any later version.
20
##
21
## This program is distributed in the hope that it will be useful, but WITHOUT
22
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
## for more details.
25
##
26 52 dgisselq
## You should have received a copy of the GNU General Public License along
27
## with this program.  (It's in the $(ROOT)/doc directory, run make with no
28
## target there if the PDF file isn't present.)  If not, see
29
##  for a copy.
30
##
31 31 dgisselq
## License:     GPL, v3, as defined and found on www.gnu.org,
32 52 dgisselq
##              http://www.gnu.org/licenses/gpl.html
33 31 dgisselq
##
34
##
35
################################################################################
36
##
37
##
38
.PHONY: all
39 52 dgisselq
PROGRAMS := exstartup oledtest gpsdump exmulti cputest cputestcis hello gettysburg # simple_ping
40 36 dgisselq
all:    $(PROGRAMS)
41 34 dgisselq
OBJDIR := obj-zip
42 49 dgisselq
NM := zip-nm
43
RDELF := zip-readelf
44 34 dgisselq
CC := zip-gcc
45
OBJDUMP := zip-objdump
46 52 dgisselq
SOURCES := exstartup.c gpsdump.c oledtest.c exmulti.c simple_ping.c ipcksum.c cputest.c hello.c gettysburg.c # ntpserver.c
47
HEADERS :=
48 41 dgisselq
DUMPRTL := -fdump-rtl-all
49
DUMPTREE:= -fdump-tree-all
50 52 dgisselq
LFLAGS  := -T arty.ld -L../zlib -Wl,--start-group -larty
51
CFLAGS  := -O3 -I../zlib
52 31 dgisselq
#
53 34 dgisselq
# For source analysis, the following macros are defined:
54 31 dgisselq
 
55 34 dgisselq
#
56
 
57
%.o: $(OBJDIR)/%.o
58
$(OBJDIR)/%.o: %.c
59 52 dgisselq
        $(CC) $(CFLAGS) -c $< -o $@
60
$(OBJDIR)/hello.o: hello.c
61
        $(CC) -O3 -c $< -o $@
62
$(OBJDIR)/gettysburg.o: gettysburg.c
63
        $(CC) -O3 -c $< -o $@
64 41 dgisselq
$(OBJDIR)/%.s: %.c
65 52 dgisselq
        $(CC) $(CFLAGS) -fdump-rtl-all -S $< -o $@
66 49 dgisselq
$(OBJDIR)/%.txt: $(OBJDIR)/%.o
67
        bash -c "$(RDELF) -a $^ ; $(OBJDUMP) -S -D $^ " | tee $@
68 34 dgisselq
%.txt: %
69
        $(OBJDUMP) -S -D $^ > $@
70
 
71 49 dgisselq
 
72 52 dgisselq
#
73
# The CPUTest program here is special--it doesn't use the C library.  Hence,
74
# it must have the -fno-builtin flag in order to build, and the -Tartyram.ld
75
# linker script to build something that doesn't go into flash but directly into
76
# RAM instead.
77
#
78
$(OBJDIR)/cputest.o: cputest.c
79
        $(CC) $(CFLAGS) -c -Wa,-nocis -fno-builtin $< -o $@
80
$(OBJDIR)/cputestcis.o: cputest.c
81
        $(CC) $(CFLAGS) -c -Wa,-cis -fno-builtin $< -o $@
82
$(OBJDIR)/cputest.s: cputest.c
83
        $(CC) $(CFLAGS) -S -Wa,-cis -fno-builtin $< -o $@
84 49 dgisselq
 
85 52 dgisselq
$(OBJDIR)/cmptst.o: cmptst.c
86
        $(CC) $(CFLAGS) -c $< -o $@
87 49 dgisselq
 
88 52 dgisselq
cputest: $(OBJDIR)/cputest.o artyram.ld
89
        $(CC) $(CFLAGS) -T artyram.ld -fno-builtin -Wl,-Map=$(OBJDIR)/cputest.map $(OBJDIR)/cputest.o -o $@
90
cputestcis: $(OBJDIR)/cputestcis.o artyram.ld
91
        $(CC) $(CFLAGS) -T artyram.ld -fno-builtin -Wl,-Map=$(OBJDIR)/cputestcis.map $(OBJDIR)/cputestcis.o -o $@
92 49 dgisselq
 
93
 
94 52 dgisselq
#
95
# Other programs are much simpler
96
exstartup: $(OBJDIR)/exstartup.o arty.ld
97
        $(CC) $(CFLAGS) $(LFLAGS) $(OBJDIR)/exstartup.o -o $@
98 49 dgisselq
 
99 52 dgisselq
exmulti: $(OBJDIR)/exmulti.o arty.ld
100
        $(CC) $(CFLAGS) $(LFLAGS) $(OBJDIR)/exmulti.o -o $@
101 31 dgisselq
 
102 52 dgisselq
gpsdump: $(OBJDIR)/gpsdump.o arty.ld
103
        $(CC) $(CFLAGS) $(LFLAGS) $(OBJDIR)/gpsdump.o -o $@
104 41 dgisselq
 
105 52 dgisselq
hello: $(OBJDIR)/hello.o arty.ld
106
        $(CC) $(CFLAGS) $(LFLAGS) $(OBJDIR)/hello.o -o $@
107
 
108
gettysburg: $(OBJDIR)/gettysburg.o arty.ld
109
        $(CC) $(CFLAGS) $(LFLAGS) $(OBJDIR)/gettysburg.o -o $@
110
 
111
oledtest: $(OBJDIR)/oledtest.o $(OBJDIR)/splash.o $(OBJDIR)/mug.o
112
        $(CC) $(CFLAGS)  $(LFLAGS) $^ -o $@
113
 
114
simple_ping: $(OBJDIR)/simple_ping.o
115
simple_ping: $(OBJDIR)/arp.o $(OBJDIR)/ipcksum.o $(OBJDIR)/ipcksum.o arty.ld
116
        $(CC) $(CFLAGS) $(LFLAGS) $^ -o simple_ping
117
 
118
cmptst: $(OBJDIR)/cmptst.o
119
        $(CC) $(CFLAGS) $(LFLAGS) $(OBJDIR)/cmptst.o -o $@
120
 
121 31 dgisselq
exstartup.txt: exstartup
122 34 dgisselq
        $(OBJDUMP) -S -D $^ > $@
123 31 dgisselq
 
124 33 dgisselq
clean:
125 52 dgisselq
        rm -rf $(PROGRAMS) $(addsuffix .map,$(PROGRAMS))
126
        rm -rf $(addsuffix .txt,$(PROGRAMS))
127 34 dgisselq
        rm -rf $(OBJDIR)/
128
 
129
define  build-depends
130
        @echo "Building dependency file(s)"
131
        @$(CC) $(CFLAGS) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt
132
        @sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
133
        @rm $(OBJDIR)/xdepends.txt
134
endef
135
 
136
tags: $(SOURCES) $(HEADERS)
137
        @echo "Generating tags"
138
        @ctags $(SOURCES) $(HEADERS)
139
 
140
$(OBJDIR)/depends.txt: $(OBJDIR)/
141
        $(build-depends)
142
 
143 49 dgisselq
.PHONY: depends
144
depends:
145
        $(build-depends)
146
 
147 34 dgisselq
$(OBJDIR)/:
148
        @bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR)/; fi"
149
 
150
-include $(OBJDIR)/depends.txt

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.