-
-
Notifications
You must be signed in to change notification settings - Fork 54
/
makefile
110 lines (88 loc) · 4.2 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Copyright (C) 2015-2024 CE Programming
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
DESTDIR = $(CURDIR)/
PREFIX = CEdev
include $(CURDIR)/src/common.mk
LIBS := libload graphx fontlibc keypadc fileioc usbdrvce srldrvce msddrvce fatdrvce
SRCS := ce crt libc libcxx
TOOLS := fasmg convbin convimg convfont cedev-config
ifeq ($(OS),Windows_NT)
WINDOWS_COPY := $(call COPY,resources\windows\make.exe,$(INSTALL_BIN)) && $(call COPY,resources\windows\cedev.bat,$(INSTALL_DIR))
else
WINDOWS_COPY :=
endif
SRCDIR = $(call NATIVEPATH,src/$1)
TOOLSDIR = $(call NATIVEPATH,tools/$1)
all: $(TOOLS) $(SRCS) $(LIBS)
$(TOOLS): check
$(Q)$(MAKE) -C $(call TOOLSDIR,$@)
$(SRCS):
$(Q)$(MAKE) -C $(call SRCDIR,$@)
$(LIBS): fasmg
$(Q)$(MAKE) -C $(call SRCDIR,$@)
install: all $(addprefix install-,$(SRCS)) $(addprefix install-,$(LIBS))
$(Q)$(MAKE) -f linker.mk -C src -B
$(Q)$(call MKDIR,$(INSTALL_DIR))
$(Q)$(call MKDIR,$(INSTALL_BIN))
$(Q)$(call MKDIR,$(INSTALL_H))
$(Q)$(call MKDIR,$(INSTALL_TI_H))
$(Q)$(call MKDIR,$(INSTALL_HW_H))
$(Q)$(call MKDIR,$(INSTALL_LIB))
$(Q)$(call MKDIR,$(INSTALL_META))
$(Q)$(call MKDIR,$(INSTALL_EXAMPLES))
$(Q)$(call COPYDIR,$(call NATIVEPATH,examples/*),$(INSTALL_EXAMPLES))
$(Q)$(call COPY,$(call NATIVEPATH,src/makefile.mk),$(INSTALL_META))
$(Q)$(call COPY,$(call NATIVEPATH,src/linker_script),$(INSTALL_META))
$(Q)$(call COPY,$(call NATIVEPATH,tools/fasmg/fasmg-ez80/commands.alm),$(INSTALL_META))
$(Q)$(call COPY,$(call NATIVEPATH,tools/fasmg/fasmg-ez80/ez80.alm),$(INSTALL_META))
$(Q)$(call COPY,$(call NATIVEPATH,tools/fasmg/fasmg-ez80/ld.alm),$(INSTALL_META))
$(Q)$(call COPY,$(call NATIVEEXE,tools/convfont/convfont),$(INSTALL_BIN))
$(Q)$(call COPY,$(call NATIVEEXE,tools/convimg/bin/convimg),$(INSTALL_BIN))
$(Q)$(call COPY,$(call NATIVEEXE,tools/convbin/bin/convbin),$(INSTALL_BIN))
$(Q)$(call COPY,$(call NATIVEEXE,tools/cedev-config/bin/cedev-config),$(INSTALL_BIN))
$(Q)$(WINDOWS_COPY)
$(addprefix install-,$(SRCS)): $(TOOLS)
$(Q)$(MAKE) -C $(call SRCDIR,$(patsubst install-%,%,$@)) install PREFIX=$(PREFIX) DESTDIR=$(DESTDIR)
$(addprefix install-,$(LIBS)): $(TOOLS)
$(Q)$(MAKE) -C $(call SRCDIR,$(patsubst install-%,%,$@)) install PREFIX=$(PREFIX) DESTDIR=$(DESTDIR)
libs: $(LIBS) $(TOOLS)
$(Q)$(call NATIVEEXE,tools/convbin/bin/convbin) --oformat 8xg-auto-extract \
$(foreach library,$(LIBS),$(addprefix --input ,$(call SRCDIR,$(library))/$(library).8xv)) --output $(call NATIVEPATH,clibs.8xg)
libs-zip:
$(Q)$(call MKDIR,clibs)
$(Q)$(foreach library,$(LIBS),$(call COPY,$(call NATIVEPATH,$(call SRCDIR,$(library))/$(library).8xv),clibs) &&) $(call NATIVEEXE,7z) a clibs_separately_in_zip.zip clibs
clean: $(addprefix clean-,$(TOOLS)) $(addprefix clean-,$(SRCS)) $(addprefix clean-,$(LIBS))
$(Q)$(call REMOVE,src/linker_script)
$(Q)$(call REMOVE,clibs.8xg)
$(Q)$(call RMDIR,docs/build)
$(Q)$(call RMDIR,docs/doxygen)
$(addprefix clean-,$(LIBS)):
$(Q)$(MAKE) -C $(call SRCDIR,$(patsubst clean-%,%,$@)) clean
$(addprefix clean-,$(SRCS)):
$(Q)$(MAKE) -C $(call SRCDIR,$(patsubst clean-%,%,$@)) clean
$(addprefix clean-,$(TOOLS)):
$(Q)$(MAKE) -C $(call TOOLSDIR,$(patsubst clean-%,%,$@)) clean
check:
$(Q)$(EZCC) --version || ( echo Please install ez80-clang && exit 1 )
$(Q)$(FASMG) $(NULL) $(NULL) || ( echo Please install fasmg && exit 1 )
docs:
$(Q)$(MAKE) -C docs html
local-docs:
$(Q)$(MAKE) -C docs local-html
.PHONY: $(LIBS) $(SRCS)
.PHONY: $(addprefix install-,$(SRCS)) $(addprefix install-,$(LIBS))
.PHONY: $(addprefix clean-,$(SRCS)) $(addprefix clean-,$(LIBS))
.PHONY: all check clean install libs docs local-docs