-
Notifications
You must be signed in to change notification settings - Fork 154
/
Makefile
198 lines (169 loc) · 5.88 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#
# Makefile
#
# Global Makefile for macchina.io
#
.PHONY: build clean all clean_bundles install_sdk install_runtime install docs
PRODUCT ?= sdk
DESTDIR ?= /usr/local/macchina
INSTALLDIR ?= $(DESTDIR)
sinclude components.make
RUNTIME_LIBS = PocoFoundation PocoXML PocoJSON PocoUtil PocoZip PocoOSP PocoRemotingNG PocoGeo
HOST_LIBS = PocoFoundation PocoXML PocoJSON PocoUtil PocoNet PocoZip PocoOSP PocoRemotingNG PocoCppParser PocoCodeGeneration
HOST_TOOLS = OSP/BundleCreator OSP/CodeCacheUtility OSP/StripBundle RemotingNG/RemoteGen PageCompiler PageCompiler/File2Page
ifdef MACCHINA_ENABLE_ACTIVERECORD
HOST_TOOLS += ActiveRecord/Compiler
endif
MACCHINA_BASE = $(shell pwd)
POCO_BASE = $(MACCHINA_BASE)/platform
PROJECT_BASE = $(MACCHINA_BASE)
export MACCHINA_BASE
export POCO_BASE
export PROJECT_BASE
# Get SDK_DIRS from SDK.make
include SDK.make
ifeq ($(PRODUCT),sdk)
BUILD_TARGET = all
INSTALL_TARGET = install_sdk
else ifeq ($(PRODUCT),runtime)
BUILD_TARGET = all
INSTALL_TARGET = install_runtime
MAKEARGS = DEFAULT_TARGET=shared_release
else ifeq ($(PRODUCT),hosttools)
BUILD_TARGET = hosttools
INSTALL_TARGET = install_hosttools
else
$(error Invalid PRODUCT specified: $(PRODUCT))
endif
POCO_HOST_OSNAME = $(shell uname)
POCO_HOST_OSARCH ?= $(subst /,-,$(shell uname -m | tr ' ' _))
ifeq ($(POCO_HOST_OSNAME),Darwin)
VLIBEXT = .*.dylib
LIBEXT = .dylib
else
VLIBEXT = .so.*
LIBEXT = .so
endif
ifdef ASAN
SANITIZEFLAGS = -fsanitize=address
EXTRA_GYPFLAGS = -Dasan=1
export SANITIZEFLAGS
export EXTRA_GYPFLAGS
endif
#
# If POCO_CONFIG is not set, use the OS name as configuration name
#
ifndef POCO_CONFIG
POCO_CONFIG = $(POCO_HOST_OSNAME)
endif
#
# Include System Specific Settings
#
include $(POCO_BASE)/build/config/$(POCO_CONFIG)
#
# Determine operating system
#
ifndef POCO_TARGET_OSNAME
OSNAME := $(POCO_HOST_OSNAME)
else
OSNAME := $(POCO_TARGET_OSNAME)
endif
ifndef POCO_TARGET_OSARCH
OSARCH := $(subst /,-,$(shell uname -m | tr ' ' _))
else
OSARCH := $(POCO_TARGET_OSARCH)
endif
#
# Make Targets
#
build: $(BUILD_TARGET)
# All macchina.io
clean all:
$(MAKE) -C platform $(MAKECMDGOALS) $(MAKEARGS)
$(MAKE) -C server $(MAKECMDGOALS) $(MAKEARGS)
$(MAKE) -C protocols $(MAKECMDGOALS) $(MAKEARGS)
$(MAKE) -C devices $(MAKECMDGOALS) $(MAKEARGS)
$(MAKE) -C services $(MAKECMDGOALS) $(MAKEARGS)
$(MAKE) -C webui $(MAKECMDGOALS) $(MAKEARGS)
$(MAKE) -C samples $(MAKECMDGOALS) $(MAKEARGS)
clean_bundles:
rm platform/OSP/bundles/*.bndl
rm */bundles/*.bndl
# Host tools only
hosttools:
$(MAKE) -C platform/Foundation
$(MAKE) -C platform/XML
$(MAKE) -C platform/JSON
$(MAKE) -C platform/Util
$(MAKE) -C platform/Net
$(MAKE) -C platform/Zip
ifdef MACCHINA_ENABLE_ACTIVERECORD
$(MAKE) -C platform/ActiveRecord/Compiler
endif
$(MAKE) -C platform/OSP
$(MAKE) -C platform/OSP/BundleCreator
$(MAKE) -C platform/OSP/CodeCacheUtility
$(MAKE) -C platform/OSP/StripBundle
$(MAKE) -C platform/CppParser
$(MAKE) -C platform/CodeGeneration
$(MAKE) -C platform/RemotingNG
$(MAKE) -C platform/RemotingNG/RemoteGen
$(MAKE) -C platform/PageCompiler
$(MAKE) -C platform/PageCompiler/File2Page
install: $(INSTALL_TARGET)
install_hosttools:
install -d $(INSTALLDIR)/lib
install -d $(INSTALLDIR)/bin
for comp in $(HOST_TOOLS) ; do \
if [ -d "platform/$$comp/bin/$(POCO_HOST_OSNAME)/$(POCO_HOST_OSARCH)" ] ; then \
find platform/$$comp/bin/$(POCO_HOST_OSNAME)/$(POCO_HOST_OSARCH) -perm -700 -type f -exec install {} $(INSTALLDIR)/bin \; ; \
fi ; \
done
for comp in $(HOST_LIBS) ; do \
find platform/lib/$(POCO_HOST_OSNAME)/$(POCO_HOST_OSARCH) -name "lib$$comp*" -type f -exec cp -f {} $(INSTALLDIR)/lib \; ; \
done
install_sdk:
install -d $(INSTALLDIR)/include
install -d $(INSTALLDIR)/lib
install -d $(INSTALLDIR)/lib/bundles
install -d $(INSTALLDIR)/bin
install -d $(INSTALLDIR)/etc
$(MAKE) -C platform install INSTALLDIR=$(abspath $(INSTALLDIR))
for sdk in $(SDK_DIRS) ; do \
cp -Rf $$sdk/include/* $(INSTALLDIR)/include ;\
done
find $(MACCHINA_BASE)/lib/$(OSNAME)/$(OSARCH) -name "libIoT*" -type f -exec cp -f {} $(INSTALLDIR)/lib \;
find $(MACCHINA_BASE)/lib/$(OSNAME)/$(OSARCH) -name "libIoT*" -type l -exec cp -Rf {} $(INSTALLDIR)/lib \;
find $(MACCHINA_BASE)/server/bin/$(OSNAME)/$(OSARCH) -perm -700 -type f -name 'macchina*' -exec install {} $(INSTALLDIR)/bin \;
cp -f $(POCO_BASE)/OSP/bundles/*.bndl $(INSTALLDIR)/lib/bundles
cp -f $(MACCHINA_BASE)/*/bundles/*.bndl $(INSTALLDIR)/lib/bundles
rm -f $(INSTALLDIR)/bin/*$(LIBEXT)
cp $(MACCHINA_BASE)/server/macchina.properties.install $(INSTALLDIR)/etc/macchina.properties
cp $(MACCHINA_BASE)/server/rootcert.pem $(INSTALLDIR)/etc
cp $(MACCHINA_BASE)/server/macchina.pem $(INSTALLDIR)/etc
install_runtime:
install -d $(INSTALLDIR)/lib
install -d $(INSTALLDIR)/lib/bundles
install -d $(INSTALLDIR)/bin
install -d $(INSTALLDIR)/etc
find $(MACCHINA_BASE)/server/bin/$(OSNAME)/$(OSARCH) -perm -700 -type f -name macchina -exec install {} $(INSTALLDIR)/bin \;
for lib in $(RUNTIME_LIBS) ; do \
find $(POCO_BASE)/lib/$(OSNAME)/$(OSARCH) -name "lib$$lib$(VLIBEXT)" -type f -exec cp -f {} $(INSTALLDIR)/lib \; ; \
done
cp -f $(POCO_BASE)/OSP/bundles/*.bndl $(INSTALLDIR)/lib/bundles
cp -f $(MACCHINA_BASE)/*/bundles/*.bndl $(INSTALLDIR)/lib/bundles
cp $(MACCHINA_BASE)/server/macchina.properties.install $(INSTALLDIR)/etc/macchina.properties
cp $(MACCHINA_BASE)/server/rootcert.pem $(INSTALLDIR)/etc
cp $(MACCHINA_BASE)/server/macchina.pem $(INSTALLDIR)/etc
if [ -d $(POCO_BASE)/OSP/Shell/Client/bin/$(OSNAME)/$(OSARCH) ] ; then \
find $(POCO_BASE)/OSP/Shell/Client/bin/$(OSNAME)/$(OSARCH) -perm -700 -type f -name ospsh -exec install {} $(INSTALLDIR)/bin \; ; \
fi
docs: hosttools
$(MAKE) -C tools/PocoDoc
tools/PocoDoc/bin/$(POCO_HOST_OSNAME)/$(POCO_HOST_OSARCH)/PocoDoc --config=tools/PocoDoc/cfg/macchina.xml
docker-image:
docker pull alpine:3.18
docker build -t macchina/edge .
docker-sdk-image:
docker pull alpine:3.18
docker build -f Dockerfile-SDK -t macchina/edge-sdk .