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

Subversion Repositories s6soc

[/] [s6soc/] [trunk/] [sw/] [dev/] [Makefile] - Diff between revs 12 and 15

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 12 Rev 15
################################################################################
################################################################################
##
##
## Filename:    Makefile        (sw/dev)
## Filename:    Makefile        (sw/dev)
##
##
## Project:     CMod S6 System on a Chip, ZipCPU demonstration project
## Project:     CMod S6 System on a Chip, ZipCPU demonstration project
##
##
## Purpose:     This makefile supports (directs) the building of the various
## Purpose:     This makefile supports (directs) the building of the various
##              software for the S6 Cmod board.
##              software for the S6 Cmod board.
##
##
##      Targets:
##      Targets:
##
##
##      (all)           Builds all of the program files
##      (all)           Builds all of the program files
##
##
##      clean           Removes all object files, the dependency file,
##      clean           Removes all object files, the dependency file,
##                              and any programs that have been built.
##                              and any programs that have been built.
##
##
##      depends         Builds a master dependency file
##      depends         Builds a master dependency file
##
##
## Creator:     Dan Gisselquist, Ph.D.
## Creator:     Dan Gisselquist, Ph.D.
##              Gisselquist Technology, LLC
##              Gisselquist Technology, LLC
##
##
################################################################################
################################################################################
##
##
## Copyright (C) 2015-2016, Gisselquist Technology, LLC
## Copyright (C) 2015-2016, Gisselquist Technology, LLC
##
##
## This program is free software (firmware): you can redistribute it and/or
## This program is free software (firmware): you can redistribute it and/or
## modify it under the terms of  the GNU General Public License as published
## modify it under the terms of  the GNU General Public License as published
## by the Free Software Foundation, either version 3 of the License, or (at
## by the Free Software Foundation, either version 3 of the License, or (at
## your option) any later version.
## your option) any later version.
##
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
## for more details.
## for more details.
##
##
## You should have received a copy of the GNU General Public License along
## You should have received a copy of the GNU General Public License along
## with this program.  (It's in the $(ROOT)/doc directory, run make with no
## with this program.  (It's in the $(ROOT)/doc directory, run make with no
## target there if the PDF file isn't present.)  If not, see
## target there if the PDF file isn't present.)  If not, see
##  for a copy.
##  for a copy.
##
##
## License:     GPL, v3, as defined and found on www.gnu.org,
## License:     GPL, v3, as defined and found on www.gnu.org,
##              http://www.gnu.org/licenses/gpl.html
##              http://www.gnu.org/licenses/gpl.html
##
##
##
##
################################################################################
################################################################################
##
##
##
##
all:
all:
PROGRAMS := helloworld
PROGRAMS := helloworld
all: $(OBJDIR)/ $(PROGRAMS)
all: $(OBJDIR)/ $(PROGRAMS)
OBJDIR := obj-zip
OBJDIR := obj-zip
CROSS := zip
CROSS := zip
CC    := $(CROSS)-gcc
CC    := $(CROSS)-gcc
AS    := $(CROSS)-as
AS    := $(CROSS)-as
LD    := $(CROSS)-ld
LD    := $(CROSS)-ld
SED   := sed
SED   := sed
OBJDUMP := $(CROSS)-objdump
OBJDUMP := $(CROSS)-objdump
# Not for build, for for building tags and dependency files, we need to know
# Not for build, for for building tags and dependency files, we need to know
# what the sources and headers are
# what the sources and headers are
SOURCES:= helloworld.c doorbell.c
DEVDRVR:= keypad.c display.c rtcsim.c
 
SOURCES:= helloworld.c doorbell.c doorbell2.c $(DEVDRVR)
HEADERS:= board.h
HEADERS:= board.h
# OBJECTS:= $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SOURCES)))
# OBJECTS:= $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SOURCES)))
 
OBJDRVR := $(addprefix $(OBJDIR)/,$(subst .c,.o,$(DEVDRVR)))
 
 
CPPFLAGS := -I../zipos -I.
CPPFLAGS := -I../zipos -I.
CFLAGS   := -O3 -Wall -Wextra -nostdlib -fno-builtin
CFLAGS   := -O3 -Wall -Wextra -nostdlib -fno-builtin
LDFLAGS   = -T cmod.ld -Wl,-Map,$(OBJDIR)/$@.map -Wl,--unresolved-symbols=report-all -nostdlib
LDFLAGS   = -T cmod.ld -Wl,-Map,$(OBJDIR)/$@.map -Wl,--unresolved-symbols=report-all -nostdlib
$(OBJDIR)/:
$(OBJDIR)/:
        @bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
        @bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
%.o: $(OBJDIR)/%.o
%.o: $(OBJDIR)/%.o
$(OBJDIR)/%.o: %.c
$(OBJDIR)/%.o: %.c
        $(CC) $(CFLAGS) -c $< -o $@
        $(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.s: %.c
$(OBJDIR)/%.s: %.c
        $(CC) -S $(CFLAGS) -c $< -o $@
        $(CC) -S $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.txt: $(OBJDIR)/%.o
$(OBJDIR)/%.txt: $(OBJDIR)/%.o
        $(OBJDUMP) -dr $^ > $@
        $(OBJDUMP) -dr $^ > $@
helloworld: $(OBJDIR)/ $(OBJDIR)/helloworld.o cmod.ld
helloworld: $(OBJDIR)/ $(OBJDIR)/helloworld.o cmod.ld
        $(CC) $(LDFLAGS) $(OBJDIR)/helloworld.o -o $@
        $(CC) $(LDFLAGS) $(OBJDIR)/helloworld.o -o $@
$(OBJDIR)/helloworld.txt: helloworld
$(OBJDIR)/helloworld.txt: helloworld
        $(OBJDUMP) -dr $^ > $@
        $(OBJDUMP) -dr $^ > $@
 
 
 
doorbell2: $(OBJDIR)/ $(OBJDIR)/doorbell2.o $(OBJDRVR) cmod.ld
 
        $(CC) $(LDFLAGS) $(OBJDIR)/doorbell2.o $(OBJDRVR) -o $@
 
$(OBJDIR)/doorbell2.txt: doorbell2
 
        $(OBJDUMP) -dr $^ > $@
 
 
define  build-depends
define  build-depends
        @echo "Building dependency file(s)"
        @echo "Building dependency file(s)"
        $(CC) $(CPPFLAGS) -MM $(SOURCES) > $(OBJDIR)/xdep.txt
        $(CC) $(CPPFLAGS) -MM $(SOURCES) > $(OBJDIR)/xdep.txt
        $(SED) -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdep.txt > $(OBJDIR)/depends.txt
        $(SED) -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdep.txt > $(OBJDIR)/depends.txt
        @rm $(OBJDIR)/xdep.txt
        @rm $(OBJDIR)/xdep.txt
endef
endef
.PHONY: depends
.PHONY: depends
depends: $(OBJDIR)/ tags
depends: $(OBJDIR)/ tags
        $(build-depends)
        $(build-depends)
tags: $(SOURCES) $(HEADERS)
tags: $(SOURCES) $(HEADERS)
        @echo "Generating tags"
        @echo "Generating tags"
        @ctags $(SOURCES) $(HEADERS)
        @ctags $(SOURCES) $(HEADERS)
.PHONY: clean
.PHONY: clean
clean:
clean:
        rm -rf $(OBJDIR)/ $(PROGRAMS)
        rm -rf $(OBJDIR)/ $(PROGRAMS)
-include $(OBJDIR)/depends.txt
-include $(OBJDIR)/depends.txt
 
 

powered by: WebSVN 2.1.0

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