1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22# Builds the SimpleBootstrap_cpp example of the SDK.
23
24PRJ=../../../..
25SETTINGS=$(PRJ)/settings
26
27include $(SETTINGS)/settings.mk
28include $(SETTINGS)/std.mk
29include $(SETTINGS)/dk.mk
30
31# Define non-platform/compiler specific settings
32APP_NAME=SimpleBootstrap_cpp
33
34OUT_APP_INC = $(OUT_INC)/$(APP_NAME)
35OUT_APP_GEN = $(OUT_MISC)/$(APP_NAME)
36OUT_APP_OBJ=$(OUT_OBJ)/$(APP_NAME)
37
38CXXFILES = SimpleBootstrap_cpp.cxx
39
40OBJFILES = $(patsubst %.cxx,$(OUT_SLO_COMP)/%.$(OBJ_EXT),$(CXXFILES))
41
42# Targets
43.PHONY: ALL
44ALL : \
45	SimpleBootstrapCppExample
46
47include $(SETTINGS)/stdtarget.mk
48
49$(OUT_APP_OBJ)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG)
50	-$(MKDIR) $(subst /,$(PS),$(@D))
51	$(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_APP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $<
52
53$(OUT_BIN)/_$(APP_NAME)$(EXE_EXT) : $(OUT_APP_OBJ)/$(APP_NAME).$(OBJ_EXT)
54	-$(MKDIR) $(subst /,$(PS),$(@D))
55	-$(MKDIR) $(subst /,$(PS),$(OUT_APP_GEN))
56ifeq "$(OS)" "WIN"
57	$(LINK) $(EXE_LINK_FLAGS) /OUT:$@ /MAP:$(OUT_APP_GEN)/$(basename $(@F)).map \
58	  $< $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB)
59else
60	$(LINK) $(EXE_LINK_FLAGS) $(LINK_LIBS) -o $@ $< \
61	  $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) $(STDC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALHELPERDYLIB) $(SALDYLIB)
62ifeq "$(OS)" "MACOSX"
63	$(INSTALL_NAME_URELIBS_BIN)  $@
64endif
65endif
66
67$(OUT_BIN)/$(APP_NAME)$(EXE_EXT) : $(OUT_BIN)/_$(APP_NAME)$(EXE_EXT)
68	-$(MKDIR) $(subst /,$(PS),$(@D))
69	$(COPY) $(subst /,$(PS),$(BIN_DIR)/unoapploader$(EXE_EXT)) $(subst /,$(PS),$@)
70# workaround for touch problem under Windows with full qualified paths
71	make -t $@
72
73SimpleBootstrapCppExample : $(OUT_BIN)/$(APP_NAME)$(EXE_EXT)
74	@echo --------------------------------------------------------------------------------
75	@echo Please use the following command to execute the example!
76	@echo -
77	@echo $(MAKE) SimpleBootstrap_cpp.run
78	@echo --------------------------------------------------------------------------------
79
80%.run: $(OUT_BIN)/SimpleBootstrap_cpp$(EXE_EXT)
81	cd $(subst /,$(PS),$(OUT_BIN)) && $(basename $@)
82
83.PHONY: clean
84clean :
85	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_INC))
86	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_GEN))
87	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_OBJ))
88	-$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_BIN)/*SimpleBootstrap*))
89