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

Subversion Repositories s6soc

[/] [s6soc/] [trunk/] [sw/] [dev/] [Makefile] - Blame information for rev 12

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 dgisselq
################################################################################
2
##
3
## Filename:    Makefile        (sw/dev)
4
##
5
## Project:     CMod S6 System on a Chip, ZipCPU demonstration project
6
##
7
## Purpose:     This makefile supports (directs) the building of the various
8
##              software for the S6 Cmod board.
9
##
10
##      Targets:
11
##
12
##      (all)           Builds all of the program files
13
##
14
##      clean           Removes all object files, the dependency file,
15
##                              and any programs that have been built.
16
##
17
##      depends         Builds a master dependency file
18
##
19
## Creator:     Dan Gisselquist, Ph.D.
20
##              Gisselquist Technology, LLC
21
##
22
################################################################################
23
##
24
## Copyright (C) 2015-2016, Gisselquist Technology, LLC
25
##
26
## This program is free software (firmware): you can redistribute it and/or
27
## modify it under the terms of  the GNU General Public License as published
28
## by the Free Software Foundation, either version 3 of the License, or (at
29
## your option) any later version.
30
##
31
## This program is distributed in the hope that it will be useful, but WITHOUT
32
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
33
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
34
## for more details.
35
##
36
## You should have received a copy of the GNU General Public License along
37
## with this program.  (It's in the $(ROOT)/doc directory, run make with no
38
## target there if the PDF file isn't present.)  If not, see
39
##  for a copy.
40
##
41
## License:     GPL, v3, as defined and found on www.gnu.org,
42
##              http://www.gnu.org/licenses/gpl.html
43
##
44
##
45
################################################################################
46
##
47
##
48
all:
49
PROGRAMS := helloworld
50
all: $(OBJDIR)/ $(PROGRAMS)
51
 
52
 
53
OBJDIR := obj-zip
54
CROSS := zip
55
CC    := $(CROSS)-gcc
56
AS    := $(CROSS)-as
57
LD    := $(CROSS)-ld
58
SED   := sed
59
OBJDUMP := $(CROSS)-objdump
60
 
61
# Not for build, for for building tags and dependency files, we need to know
62
# what the sources and headers are
63
SOURCES:= helloworld.c doorbell.c
64
HEADERS:= board.h
65
# OBJECTS:= $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SOURCES)))
66
 
67
 
68
CPPFLAGS := -I../zipos -I.
69
CFLAGS   := -O3 -Wall -Wextra -nostdlib -fno-builtin
70
LDFLAGS   = -T cmod.ld -Wl,-Map,$(OBJDIR)/$@.map -Wl,--unresolved-symbols=report-all -nostdlib
71
 
72
$(OBJDIR)/:
73
        @bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
74
 
75
%.o: $(OBJDIR)/%.o
76
 
77
$(OBJDIR)/%.o: %.c
78
        $(CC) $(CFLAGS) -c $< -o $@
79
 
80
$(OBJDIR)/%.s: %.c
81
        $(CC) -S $(CFLAGS) -c $< -o $@
82
 
83
$(OBJDIR)/%.txt: $(OBJDIR)/%.o
84
        $(OBJDUMP) -dr $^ > $@
85
 
86
 
87
helloworld: $(OBJDIR)/ $(OBJDIR)/helloworld.o cmod.ld
88
        $(CC) $(LDFLAGS) $(OBJDIR)/helloworld.o -o $@
89
$(OBJDIR)/helloworld.txt: helloworld
90
        $(OBJDUMP) -dr $^ > $@
91
 
92
define  build-depends
93
        @echo "Building dependency file(s)"
94
        $(CC) $(CPPFLAGS) -MM $(SOURCES) > $(OBJDIR)/xdep.txt
95
        $(SED) -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdep.txt > $(OBJDIR)/depends.txt
96
        @rm $(OBJDIR)/xdep.txt
97
endef
98
 
99
.PHONY: depends
100
depends: $(OBJDIR)/ tags
101
        $(build-depends)
102
 
103
tags: $(SOURCES) $(HEADERS)
104
        @echo "Generating tags"
105
        @ctags $(SOURCES) $(HEADERS)
106
 
107
.PHONY: clean
108
clean:
109
        rm -rf $(OBJDIR)/ $(PROGRAMS)
110
 
111
-include $(OBJDIR)/depends.txt

powered by: WebSVN 2.1.0

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