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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [zasm/] [Makefile] - Blame information for rev 9

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

Line No. Rev Author Line
1 2 dgisselq
################################################################################
2
#
3
# Filename:     Makefile
4
#
5
# Project:      Zip CPU -- a small, lightweight, RISC CPU soft core
6
#
7
# Purpose:      This makefile builds an assembler and disassembler.
8
#
9
#
10
# Creator:      Dan Gisselquist, Ph.D.
11
#               Gisselquist Tecnology, LLC
12
#
13
################################################################################
14
#
15
# Copyright (C) 2015, Gisselquist Technology, LLC
16
#
17
# This program is free software (firmware): you can redistribute it and/or
18
# modify it under the terms of  the GNU General Public License as published
19
# by the Free Software Foundation, either version 3 of the License, or (at
20
# your option) any later version.
21
#
22
# This program is distributed in the hope that it will be useful, but WITHOUT
23
# ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
24
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25
# for more details.
26
#
27
# License:      GPL, v3, as defined and found on www.gnu.org,
28
#               http://www.gnu.org/licenses/gpl.html
29
#
30
#
31
################################################################################
32
#
33
.PHONY: all
34
all:    zasm optest zdump
35
OBJDIR= obj-pc
36
CXX=    g++
37
CC=     gcc
38
YYMMDD=`date +%Y%m%d`
39
DBGFLAGS= -g -O0
40
OPTFLAGS= -O3
41
CCFLAGS= $(DBGFLAGS)
42
PROGRAMS= zasm optest zdump
43
 
44
.PHONY: programs
45
all:    $(OBJDIR)/ programs
46
 
47
programs:       $(PROGRAMS)
48
 
49
ZASMSRC= zasm.cpp zopcodes.cpp zparser.cpp twoc.cpp
50
ZASMOBJ= $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(ZASMSRC)))
51
zasm:   $(ZASMOBJ)
52
        $(CXX) $(CCFLAGS) $(ZASMOBJ) -o $@
53
 
54
optest: optest.cpp zopcodes.cpp twoc.cpp twoc.h zopcodes.h
55
        $(CXX) $(CCFLAGS) optest.cpp zopcodes.cpp twoc.cpp -o optest
56
 
57
ZDMPSRC= zdump.cpp zopcodes.cpp twoc.cpp
58
ZDMPOBJ= $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(ZDMPSRC)))
59
zdump:  $(ZDMPOBJ)
60
        $(CXX) $(CCFLAGS) $(ZDMPOBJ) -o $@
61
 
62
$(OBJDIR)/%.o: %.cpp
63
        $(CXX) -c $(CCFLAGS) $< -o $@
64
 
65
$(OBJDIR)/:
66
        @bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
67
 
68
define  build-depends
69
        @echo "Building dependency file(s)"
70
        @$(CXX) $(CCFLAGS) -MM *.cpp > xd.txt
71
        @sed -e 's/^.*.o: /$(OBJDIR)\/&/' < xd.txt > $(OBJDIR)/depends.txt
72
        @rm xd.txt
73
endef
74
 
75
tags: $(SOURCES) $(HEADERS)
76
        @echo "Generating tags"
77
        @ctags *.cpp *.h # $(SOURCES) $(HEADERS)
78
 
79
.PHONY: depends
80
depends: tags
81
        $(build-depends)
82
 
83
$(OBJDIR)/depends.txt: $(OBJDIR)/ $(SOURCES) $(HEADERS)
84
        $(build-depends)
85
 
86
.PHONY: clean
87
clean:
88
        rm -rf $(OBJDIR) $(PROGRAMS)
89
 
90
-include $(OBJDIR)/depends.txt
91
 
92
 
93
 
94
 
95
 
96
 
97
 
98
 

powered by: WebSVN 2.1.0

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