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

Subversion Repositories s6soc

[/] [s6soc/] [trunk/] [sw/] [zipos/] [Makefile] - Blame information for rev 40

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

Line No. Rev Author Line
1 22 dgisselq
################################################################################
2
##
3
## Filename:    Makefile
4
##
5
## Project:     CMod S6 System on a Chip, ZipCPU demonstration project
6
##
7
## Purpose:     To coordinate the build of a small ZipOS.
8
##
9
## Creator:     Dan Gisselquist, Ph.D.
10
##              Gisselquist Technology, LLC
11
##
12
################################################################################
13
##
14
## Copyright (C) 2015-2016, Gisselquist Technology, LLC
15
##
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
## 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
## License:     GPL, v3, as defined and found on www.gnu.org,
32
##              http://www.gnu.org/licenses/gpl.html
33
##
34
##
35
################################################################################
36
##
37
##
38
all:
39
 
40
CROSS   := zip-
41
CC      := $(CROSS)gcc
42
AS      := $(CROSS)as
43
OBJDUMP := $(CROSS)objdump
44
OBJDIR  := obj-zip
45
DEVSRCSR:= display.c keypad.c rtcsim.c
46
DEVSRCS := $(addprefix ../dev/,$(DEVSRCSR))
47
DEVOBJS := $(addprefix $(OBJDIR)/,$(subst .c,.o,$(DEVSRCSR)))
48 27 dgisselq
SOURCES := bootloader.c kernel.c ksetup.c syspipe.c pipesetup.c taskp.c doorbell.c zipsys.c # ziplib.c
49 22 dgisselq
OBJECTS := $(addprefix $(OBJDIR)/,$(subst .c,.o,$(SOURCES))) $(DEVOBJS) $(OBJDIR)/resetdump.o
50
HEADERS := $(wildcard *.h) $(subst .c,.h,$(DEVSRCS))
51
# CFLAGS  := -O3 -fdump-tree-all -Wall -Wextra -nostdlib -fno-builtin
52 27 dgisselq
# CFLAGS  := -O3 -fdump-rtl-all -DZIPOS -Wall -Wextra -nostdlib -fno-builtin
53 22 dgisselq
CFLAGS  := -O3 -DZIPOS -Wall -Wextra -nostdlib -fno-builtin
54
# CFLAGS  := -Wall -Wextra -nostdlib -fno-builtin
55 27 dgisselq
LDFLAGS := -T cmodram.ld -Wl,-Map,$(OBJDIR)/doorbell.map
56 22 dgisselq
 
57
all: $(OBJDIR)/ doorbell
58
$(OBJDIR)/:
59
        @bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
60
 
61
%.o: $(OBJDIR)/%.o
62
        $(CC) $(CFLAGS) -c $< -o $@
63
 
64
$(OBJDIR)/%.o: %.c
65
        $(CC) $(CFLAGS) -c $< -o $@
66
 
67
$(OBJDIR)/%.o: ../dev/%.c
68
        $(CC) $(CFLAGS) -c $< -o $@
69
 
70
$(OBJDIR)/%.txt: $(OBJDIR)/%.o
71
        $(OBJDUMP) -d $^ -o $@
72
 
73
$(OBJDIR)/%.s: %.c
74
        $(CC) -S $(CFLAGS) -c $< -o $@
75
 
76 29 dgisselq
$(OBJDIR)/%.s: ../dev/%.c
77
        $(CC) -S $(CFLAGS) -c $< -o $@
78
 
79 22 dgisselq
$(OBJDIR)/resetdump.o: resetdump.s
80
        $(AS) $^ -o $@
81
 
82 27 dgisselq
doorbell: $(OBJECTS) cmodram.ld
83 22 dgisselq
        $(CC) $(LDFLAGS) $(OBJECTS) -o $@
84
 
85
$(OBJDIR)/doorbell.txt: doorbell
86
        $(OBJDUMP) -d $^ > $@
87
 
88
define  build-depends
89
        @echo "Building dependency file(s)"
90
        @$(CC) $(CPPFLAGS) -MM $(SOURCES) $(DEVSRCS) > $(OBJDIR)/xdepends.txt
91
        @sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
92
        @rm $(OBJDIR)/xdepends.txt
93
endef
94
 
95
.PHONY: depends
96
depends: $(OBJDIR)/ tags
97
        $(build-depends)
98
 
99
tags: $(SOURCES) $(HEADERS)
100
        @echo "Generating tags"
101
        @ctags $(SOURCES) $(DEVSRCS) $(HEADERS)
102
 
103
.PHONY: clean
104
clean:
105
        rm -rf $(OBJDIR)/ doorbell
106
 
107
-include $(OBJDIR)/depends.txt

powered by: WebSVN 2.1.0

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