forked from macchina-io/macchina.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
140 lines (122 loc) · 4.08 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
#
# Makefile
#
# $Id$
#
# Global Makefile for macchina.io
#
.PHONY: clean all install_sdk install_runtime install
TARGET ?= sdk
INSTALLDIR ?= /usr/local/macchina
RUNTIME_LIBS = PocoFoundation PocoXML PocoJSON PocoUtil PocoZip PocoOSP PocoRemotingNG
MACCHINA_BASE = $(shell pwd)
POCO_BASE = $(MACCHINA_BASE)/platform
PROJECT_BASE = $(MACCHINA_BASE)
export MACCHINA_BASE
export POCO_BASE
export PROJECT_BASE
ifeq ($(TARGET),sdk)
INSTALL_TARGET = install_sdk
else ifeq ($(TARGET),runtime)
INSTALL_TARGET = install_runtime
MAKEARGS = DEFAULT_TARGET=shared_release
else
$(error Invalid TARGET specified: $(TARGET))
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
#
# 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
#
# All macchina.io
clean all:
$(MAKE) -C platform $(MAKECMDGOALS) $(MAKEARGS)
$(MAKE) -C server $(MAKECMDGOALS) $(MAKEARGS)
$(MAKE) -C devices/Devices $(MAKECMDGOALS) $(MAKEARGS)
$(MAKE) -C devices/Serial $(MAKECMDGOALS) $(MAKEARGS)
$(MAKE) -C protocols $(MAKECMDGOALS) $(MAKEARGS)
$(MAKE) -C devices $(MAKECMDGOALS) $(MAKEARGS)
$(MAKE) -C services $(MAKECMDGOALS) $(MAKEARGS)
$(MAKE) -C webui $(MAKECMDGOALS) $(MAKEARGS)
# 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
$(MAKE) -C platform/OSP
$(MAKE) -C platform/OSP/BundleCreator
$(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_sdk:
mkdir -p $(INSTALLDIR)
mkdir -p $(INSTALLDIR)/include
mkdir -p $(INSTALLDIR)/lib
mkdir -p $(INSTALLDIR)/lib/bundles
mkdir -p $(INSTALLDIR)/bin
mkdir -p $(INSTALLDIR)/etc
$(MAKE) -C platform install INSTALLDIR=$(INSTALLDIR)
cp -Rf devices/*/include/* $(INSTALLDIR)/include
cp -Rf protocols/*/include/* $(INSTALLDIR)/include
cp -Rf services/*/include/* $(INSTALLDIR)/include
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 cp -f {} $(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:
mkdir -p $(INSTALLDIR)
mkdir -p $(INSTALLDIR)/lib
mkdir -p $(INSTALLDIR)/lib/bundles
mkdir -p $(INSTALLDIR)/bin
mkdir -p $(INSTALLDIR)/etc
find $(MACCHINA_BASE)/server/bin/$(OSNAME)/$(OSARCH) -perm -700 -type f -name macchina -exec cp -f {} $(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