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

Subversion Repositories s6soc

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

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

powered by: WebSVN 2.1.0

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