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

Subversion Repositories s6soc

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

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 45 dgisselq
DEVSRCSR:= display.c keypad.c rtcsim.c txfns.c
46 22 dgisselq
DEVSRCS := $(addprefix ../dev/,$(DEVSRCSR))
47
DEVOBJS := $(addprefix $(OBJDIR)/,$(subst .c,.o,$(DEVSRCSR)))
48 45 dgisselq
SOURCES := bootloader.c kernel.c ksetup.c syspipe.c pipesetup.c taskp.c doorbell.c zipsys.c string.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 45 dgisselq
CFLAGS  := -I. -I../dev -Os -DZIPOS -Wall -Wextra -nostdlib -fno-builtin -Wa,-nocis
54
LDFLAGS := -T cmodram.ld -Wl,-Map,$(OBJDIR)/doorbell.map -nostdlib
55 22 dgisselq
 
56 45 dgisselq
all: doorbell
57 22 dgisselq
$(OBJDIR)/:
58 45 dgisselq
        $(mk-objdir)
59 22 dgisselq
 
60
%.o: $(OBJDIR)/%.o
61
 
62
$(OBJDIR)/%.o: %.c
63 45 dgisselq
        $(mk-objdir)
64 22 dgisselq
        $(CC) $(CFLAGS) -c $< -o $@
65
 
66
$(OBJDIR)/%.o: ../dev/%.c
67 45 dgisselq
        $(mk-objdir)
68 22 dgisselq
        $(CC) $(CFLAGS) -c $< -o $@
69
 
70
$(OBJDIR)/%.txt: $(OBJDIR)/%.o
71 45 dgisselq
        $(OBJDUMP) -Dr $^ > $@
72 22 dgisselq
 
73
$(OBJDIR)/%.s: %.c
74 45 dgisselq
        $(mk-objdir)
75 22 dgisselq
        $(CC) -S $(CFLAGS) -c $< -o $@
76
 
77 29 dgisselq
$(OBJDIR)/%.s: ../dev/%.c
78 45 dgisselq
        $(mk-objdir)
79 29 dgisselq
        $(CC) -S $(CFLAGS) -c $< -o $@
80
 
81 22 dgisselq
$(OBJDIR)/resetdump.o: resetdump.s
82 45 dgisselq
        $(mk-objdir)
83
        $(AS) -nocis $^ -o $@
84 22 dgisselq
 
85 27 dgisselq
doorbell: $(OBJECTS) cmodram.ld
86 22 dgisselq
        $(CC) $(LDFLAGS) $(OBJECTS) -o $@
87
 
88 45 dgisselq
doorbell.txt: doorbell
89 22 dgisselq
        $(OBJDUMP) -d $^ > $@
90
 
91 45 dgisselq
define  mk-objdir
92
        @bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
93
endef
94
 
95 22 dgisselq
define  build-depends
96
        @echo "Building dependency file(s)"
97
        @$(CC) $(CPPFLAGS) -MM $(SOURCES) $(DEVSRCS) > $(OBJDIR)/xdepends.txt
98
        @sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
99
        @rm $(OBJDIR)/xdepends.txt
100
endef
101
 
102
.PHONY: depends
103 45 dgisselq
depends: tags
104
        $(mk-objdir)
105 22 dgisselq
        $(build-depends)
106
 
107
tags: $(SOURCES) $(HEADERS)
108
        @echo "Generating tags"
109
        @ctags $(SOURCES) $(DEVSRCS) $(HEADERS)
110
 
111
.PHONY: clean
112
clean:
113
        rm -rf $(OBJDIR)/ doorbell
114
 
115
-include $(OBJDIR)/depends.txt

powered by: WebSVN 2.1.0

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