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

Subversion Repositories s6soc

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

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 29 dgisselq
PROGRAMS := helloworld doorbell doorbell2 kptest
50 12 dgisselq
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 15 dgisselq
DEVDRVR:= keypad.c display.c rtcsim.c
64 29 dgisselq
SOURCES:= helloworld.c doorbell.c doorbell2.c kptest.c $(DEVDRVR)
65 12 dgisselq
HEADERS:= board.h
66
# OBJECTS:= $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SOURCES)))
67 15 dgisselq
OBJDRVR := $(addprefix $(OBJDIR)/,$(subst .c,.o,$(DEVDRVR)))
68 12 dgisselq
 
69
 
70
CPPFLAGS := -I../zipos -I.
71
CFLAGS   := -O3 -Wall -Wextra -nostdlib -fno-builtin
72
LDFLAGS   = -T cmod.ld -Wl,-Map,$(OBJDIR)/$@.map -Wl,--unresolved-symbols=report-all -nostdlib
73
 
74
$(OBJDIR)/:
75
        @bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
76
 
77
%.o: $(OBJDIR)/%.o
78
 
79
$(OBJDIR)/%.o: %.c
80
        $(CC) $(CFLAGS) -c $< -o $@
81
 
82
$(OBJDIR)/%.s: %.c
83
        $(CC) -S $(CFLAGS) -c $< -o $@
84
 
85
$(OBJDIR)/%.txt: $(OBJDIR)/%.o
86
        $(OBJDUMP) -dr $^ > $@
87
 
88
 
89
helloworld: $(OBJDIR)/ $(OBJDIR)/helloworld.o cmod.ld
90
        $(CC) $(LDFLAGS) $(OBJDIR)/helloworld.o -o $@
91
$(OBJDIR)/helloworld.txt: helloworld
92
        $(OBJDUMP) -dr $^ > $@
93
 
94 15 dgisselq
doorbell2: $(OBJDIR)/ $(OBJDIR)/doorbell2.o $(OBJDRVR) cmod.ld
95
        $(CC) $(LDFLAGS) $(OBJDIR)/doorbell2.o $(OBJDRVR) -o $@
96
$(OBJDIR)/doorbell2.txt: doorbell2
97
        $(OBJDUMP) -dr $^ > $@
98
 
99 29 dgisselq
kptest: $(OBJDIR)/ $(OBJDIR)/kptest.o $(OBJDRVR) cmod.ld
100
        $(CC) $(LDFLAGS) $(OBJDIR)/kptest.o $(OBJDRVR) -o $@
101
$(OBJDIR)/kptest.txt: kptest
102
        $(OBJDUMP) -dr $^ > $@
103
 
104 12 dgisselq
define  build-depends
105
        @echo "Building dependency file(s)"
106
        $(CC) $(CPPFLAGS) -MM $(SOURCES) > $(OBJDIR)/xdep.txt
107
        $(SED) -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdep.txt > $(OBJDIR)/depends.txt
108
        @rm $(OBJDIR)/xdep.txt
109
endef
110
 
111
.PHONY: depends
112
depends: $(OBJDIR)/ tags
113
        $(build-depends)
114
 
115
tags: $(SOURCES) $(HEADERS)
116
        @echo "Generating tags"
117
        @ctags $(SOURCES) $(HEADERS)
118
 
119
.PHONY: clean
120
clean:
121
        rm -rf $(OBJDIR)/ $(PROGRAMS)
122
 
123
-include $(OBJDIR)/depends.txt

powered by: WebSVN 2.1.0

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