-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathMakefile.common
More file actions
194 lines (159 loc) · 8.19 KB
/
Copy pathMakefile.common
File metadata and controls
194 lines (159 loc) · 8.19 KB
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
###############################################################################
## (c) Copyright, Real-Time Innovations, All rights reserved. ##
## ##
## Permission to modify and use for internal purposes granted. ##
## This software is provided "as is", without warranty, express or implied. ##
## ##
###############################################################################
# This Makefile contains the common rules to build for all the architectures.
# It is included from the architecture-specific Makefile.
# This Makefile requires the following variables:
# - ARCH: Architecture to build (for example i86Linux2.6gcc4.4.5)
#
# Optional variables:
# - DEBUG: If set to '1', it turns on debugging information
# - SHAREDLIB: If set to '1', shared libraries will be used
# - CXX: compiler name.
# - CXXFLAGS: compiler flags: will be appended to $CXX command-line
# - CXXLD: linker name.
# - CXXLDFLAGS: linker flags: will be inserted at the beginning of CXXLD cmdline
# - SYSLIBS: additional system libraries to append to the CXXLD command-line
###############################################################################
# Ensure this Makefile is invoked with the right variable set
###############################################################################
ifeq ($(ARCH), )
all:
@echo "***************************************************************"
@echo "You cannot use this Makefile directly, instead use the"
@echo "architecture-specific Makefile. For example:"
@echo " gmake -f make/Makefile.i86Linux2.6gcc4.4.5"
@echo "***************************************************************"
@false
else
###############################################################################
# Ensure $NDDSHOME is defined
###############################################################################
ifeq ($(NDDSHOME), )
all:
@echo "***************************************************************"
@echo "The environment variable 'NDDSHOME' is not set!"
@echo "To use this makefile you need to set NDDSHOME to the directory"
@echo "where you have RTI Connext installed."
@echo "***************************************************************"
@false
endif
endif
# Define the sources and NDDS search path
INCLUDES = -Isrc/CommonInfrastructure -Isrc/Generated -I$(NDDSHOME)/include \
-I$(NDDSHOME)/include/ndds
###############################################################################
# Modify build flags for debug/release
###############################################################################
ifeq ($(DEBUG),1)
CXXFLAGS += -g -O0
ifeq ($(SHAREDLIB),1)
NDDSLIBS = -lnddscppd -lnddscd -lnddscored
else
NDDSLIBS = -lnddscppzd -lnddsczd -lnddscorezd
endif
else
CXXFLAGS += -O2
ifeq ($(SHAREDLIB),1)
NDDSLIBS = -lnddscpp -lnddsc -lnddscore
else
NDDSLIBS = -lnddscppz -lnddscz -lnddscorez
endif
endif
LIBS = -L$(NDDSHOME)/lib/$(ARCH) $(NDDSLIBS) $(SYSLIBS)
STATION_CONTROLLERLIBS = $(LIBS)
COMMONSRC = src/CommonInfrastructure/DDSCommunicator.cxx \
src/CommonInfrastructure/OSAPI.cxx \
src/CommonInfrastructure/ChocolateLotStateEntities.cxx \
src/CommonInfrastructure/EnumPrintHelpers.cxx \
COMMON_H = src/CommonInfrastructure/DDSCommunicator.h \
src/CommonInfrastructure/OSAPI.h \
src/CommonInfrastructure/DDSTypeWrapper.h \
src/CommonInfrastructure/ChocolateLotStateEntities.h \
src/CommonInfrastructure/EnumPrintHelpers.h \
SOURCES_IDL = src/Generated/ChocolateFactory.cxx \
src/Generated/ChocolateFactoryPlugin.cxx \
src/Generated/ChocolateFactorySupport.cxx
MESSRC = src/ManufacturingExecutionSystem/MESInterface.cxx \
src/ManufacturingExecutionSystem/ManufacturingExecutionSystem.cxx
RECIPESRC = src/RecipeGenerator/RecipePublisherInterface.cxx \
src/RecipeGenerator/RecipeGenerator.cxx
STATION_CONTROLLERSRC = src/StationControllerInterface.cxx \
src/StationController.cxx
HEADERS_IDL = src/Generated/ChocolateFactory.h \
src/Generated/ChocolateFactoryPlugin.h \
src/Generated/ChocolateFactorySupport.h
DIRECTORIES = objs.dir objs/$(ARCH).dir objs/$(ARCH)/ManufacturingExecutionSystem.dir \
objs/$(ARCH)/RecipeGenerator.dir objs/$(ARCH)/StationController.dir \
objs/$(ARCH)/Common.dir
SOURCES_NODIR = $(notdir $(COMMONSRC)) $(notdir $(SOURCES_IDL))
COMMONOBJS = $(SOURCES_NODIR:%.cxx=objs/$(ARCH)/Common/%.o)
EXEC = ManufacturingExecutionSystem
MESSRC_NODIR = $(notdir $(MESSRC))
MESOBJS = $(MESSRC_NODIR:%.cxx=objs/$(ARCH)/ManufacturingExecutionSystem/%.o) $(COMMONOBJS)
RECIPESRC_NODIR = $(notdir $(RECIPESRC))
RECIPEOBJS = $(RECIPESRC_NODIR:%.cxx=objs/$(ARCH)/RecipeGenerator/%.o) $(COMMONOBJS)
RECIPEEXEC = RecipeGenerator
STATION_CONTROLLERSRC_NODIR = $(notdir $(STATION_CONTROLLERSRC))
STATION_CONTROLLEROBJS = $(STATION_CONTROLLERSRC_NODIR:%.cxx=objs/$(ARCH)/StationController/%.o) $(COMMONOBJS)
STATION_CONTROLLEREXEC = StationController
###############################################################################
# Build Rules
###############################################################################
$(ARCH): ManufacturingExecutionSystem RecipeGenerator StationController
ManufacturingExecutionSystem: $(DIRECTORIES) $(MESOBJS) $(EXEC:%=objs/$(ARCH)/ManufacturingExecutionSystem/%.o) \
$(EXEC:%=objs/$(ARCH)/ManufacturingExecutionSystem/%.out)
RecipeGenerator: $(RECIPEOBJS) $(@:%=objs/$(ARCH)/RecipeGenerator/%.o) \
$(RECIPEEXEC:%=objs/$(ARCH)/RecipeGenerator/%.out)
StationController: $(STATION_CONTROLLEROBJS) $(@:%=objs/$(ARCH)/StationController/%.o) \
$(STATION_CONTROLLEREXEC:%=objs/$(ARCH)/StationController/%.out)
# Building the manufacturing execution system application
objs/$(ARCH)/ManufacturingExecutionSystem/%.out: objs/$(ARCH)/ManufacturingExecutionSystem/%.o
$(CXXLD) $(CXXLDFLAGS) -o $(@:%.out=%) $(MESOBJS) $(LIBS)
# Building the recipe generator application
objs/$(ARCH)/RecipeGenerator/%.out: objs/$(ARCH)/RecipeGenerator/%.o
$(CXXLD) $(CXXLDFLAGS) -o $(@:%.out=%) $(RECIPEOBJS) $(LIBS)
# Building the station controller application
objs/$(ARCH)/StationController/%.out: objs/$(ARCH)/StationController/%.o
$(CXXLD) $(CXXLDFLAGS) -o $(@:%.out=%) $(STATION_CONTROLLEROBJS) $(STATION_CONTROLLERLIBS)
objs/$(ARCH)/Common/%.o: src/CommonInfrastructure/%.cxx $(COMMON_H)
$(CXX) $(CXXFLAGS) -o $@ $(DEFINES) $(INCLUDES) -c $<
objs/$(ARCH)/Common/%.o: src/Generated/%.cxx $(COMMON_H)
$(CXX) $(CXXFLAGS) -o $@ $(DEFINES) $(INCLUDES) -c $<
objs/$(ARCH)/ManufacturingExecutionSystem/%.o: src/ManufacturingExecutionSystem/%.cxx $(COMMON_H) $(HEADERS_IDL)
$(CXX) $(CXXFLAGS) -o $@ $(DEFINES) $(INCLUDES) -c $<
objs/$(ARCH)/RecipeGenerator/%.o: src/RecipeGenerator/%.cxx $(COMMON_H)
$(CXX) $(CXXFLAGS) -o $@ $(DEFINES) $(INCLUDES) -c $<
objs/$(ARCH)/StationController/%.o: src/StationController/%.cxx $(COMMON_H)
$(CXX) $(CXXFLAGS) -o $@ $(DEFINES) $(INCLUDES) -c $<
# Rule to rebuild the generated files when the .idl file change
$(SOURCES_IDL) $(HEADERS_IDL): src/Idl/ChocolateFactory.idl
@mkdir -p src/Generated
ifeq ($(OS_ARCH), i86Win32)
call $(NDDSHOME)/scripts/rtiddsgen.bat -d src/idl src/ChocolateFactory.idl -replace -language C++
else
$(NDDSHOME)/scripts/rtiddsgen -namespace -d src/Generated src/Idl/ChocolateFactory.idl -replace -language C++
endif
generate: $(SOURCES_IDL) $(HEADERS_IDL)
# Here is how we create those subdirectories automatically.
%.dir :
@echo "Checking directory $*"
@if [ ! -d $* ]; then \
echo "Making directory $*"; \
mkdir -p $* ; \
fi;
###############################################################################
# Clean target: removes the objs dir
###############################################################################
clean:
@rm -Rf objs/$(ARCH)
@echo "Successfully deleted object and executable files for architecture $(ARCH)"
@echo "To delete ALL the architectures and any generated file use target 'veryclean'"
veryclean:
@rm -Rf objs
@rm -Rf src/idl
@echo "Deleted all executables, objects and generated files"