xref: /trunk/main/odk/examples/OLE/activex/Makefile (revision 34dd1e25)
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#*************************************************************************
23#
24#  The Contents of this file are made available subject to the terms of
25#  the BSD license.
26#
27#  Copyright 2000, 2010 Oracle and/or its affiliates.
28#  All rights reserved.
29#
30#  Redistribution and use in source and binary forms, with or without
31#  modification, are permitted provided that the following conditions
32#  are met:
33#  1. Redistributions of source code must retain the above copyright
34#     notice, this list of conditions and the following disclaimer.
35#  2. Redistributions in binary form must reproduce the above copyright
36#     notice, this list of conditions and the following disclaimer in the
37#     documentation and/or other materials provided with the distribution.
38#  3. Neither the name of Sun Microsystems, Inc. nor the names of its
39#     contributors may be used to endorse or promote products derived
40#     from this software without specific prior written permission.
41#
42#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
45#  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
46#  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
47#  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
48#  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
49#  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
50#  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
51#  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
52#  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53#
54#**************************************************************************
55
56# Builds the OLE activex C++ component example of the SDK.
57
58PRJ=../../..
59SETTINGS=$(PRJ)/settings
60
61include $(SETTINGS)/settings.mk
62include $(SETTINGS)/std.mk
63include $(SETTINGS)/dk.mk
64
65# Define non-platform/compiler specific settings
66COMPONENT_NAME=so_activex
67COMPONENT_IMPL_NAME=$(SHAREDLIB_PRE)$(COMPONENT_NAME).$(SHAREDLIB_EXT)
68COMPONENT_IMPL=$(SHAREDLIB_OUT)/$(SHAREDLIB_PRE)$(COMPONENT_NAME).$(SHAREDLIB_EXT)
69OUT_COMP_INC = $(OUT_INC)/$(COMPONENT_NAME)
70OUT_COMP_GEN = $(OUT_MISC)/$(COMPONENT_NAME)
71OUT_COMP_SLO=$(OUT_SLO)/$(COMPONENT_NAME)
72
73MIDLFILES = so_activex.idl
74
75CXXFILES = SOActiveX.cpp \
76	 SOComWindowPeer.cpp \
77	 so_activex.cpp \
78	 StdAfx2.cpp
79
80SLOFILES = $(patsubst %.cpp,$(OUT_COMP_SLO)/%.$(OBJ_EXT),$(CXXFILES))
81
82# Targets
83.PHONY: ALL
84ALL : \
85	OleActvieXComponentExample
86
87include $(SETTINGS)/stdtarget.mk
88
89# Attention: so_activex.idl is no UNOIDL file!
90$(OUT_COMP_INC)/so_activex.h : so_activex.idl
91	-$(MKDIR) $(subst /,$(PS),$(@D))
92	-$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN))
93	midl.exe /tlb $(OUT_COMP_GEN)/so_activex.tlb /h $(OUT_COMP_INC)/so_activex.h \
94	/iid $(OUT_COMP_INC)/so_activex_i.c /proxy $(OUT_COMP_INC)/so_activex_p.c \
95	/dlldata $(OUT_COMP_INC)/dlldata.c /Oicf $<
96
97$(OUT_COMP_GEN)/so_activex.res : so_activex.rc $(OUT_COMP_INC)/so_activex.h
98	-$(MKDIR) $(subst /,$(PS),$(@D))
99	rc $(CC_INCLUDES) /R /FO$@ so_activex.rc
100
101$(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cpp
102	-$(MKDIR) $(subst /,$(PS),$(@D))
103	$(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $<
104
105
106# Note: If you don't use the MS Visual Studio .Net, please comment out the next line.
107CL_NEW_LIB=atls.lib
108
109$(SHAREDLIB_OUT)/$(SHAREDLIB_PRE)%.$(SHAREDLIB_EXT) : $(SLOFILES) $(OUT_COMP_GEN)/so_activex.res so_activex.def
110	-$(MKDIR) $(subst /,$(PS),$(@D))
111	-$(MKDIR) $(subst /,$(PS),$(OUT_LIB))
112	@echo .
113	@echo -----------------------------------------------------------------------------------
114	@echo ATTENTION: If you have problems with linking the library and if you do not use the
115	@echo MS .Net compiler please check the makefile and comment out the variable CL_NEW_LIB.
116	@echo -----------------------------------------------------------------------------------
117	@echo .
118	$(LINK) $(LIBRARY_LINK_FLAGS) /OUT:$@ /MAP:$(OUT_COMP_GEN)/$(subst $(SHAREDLIB_EXT),map,$(@F)) \
119	/DEF:so_activex.def /IMPLIB:$(OUT_LIB)/iso_activex.lib $(SLOFILES) \
120	msvcrt.lib kernel32.lib user32.lib uuid.lib advapi32.lib ole32.lib oleaut32.lib gdi32.lib \
121	urlmon.lib Shlwapi.lib oldnames.lib $(CL_NEW_LIB) $(OUT_COMP_GEN)/so_activex.res
122	$(LINK_MANIFEST)
123
124ifeq "$(OS)" "WIN"
125OleActvieXComponentExample : $(COMPONENT_IMPL)
126	@echo --------------------------------------------------------------------------------
127	@echo The activex control was created, please load the "$(QM)example.html$(QM)" file
128	@echo in your InternetExplorer to use the activex control.
129	@echo --------------------------------------------------------------------------------
130else
131OleActvieXComponentExample :
132	@echo --------------------------------------------------------------------------------
133	@echo This example works only under Windows!
134	@echo --------------------------------------------------------------------------------
135endif
136
137.PHONY: clean
138clean :
139	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC))
140	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN))
141	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO))
142	-$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_LIB)/*$(COMPONENT_NAME).*))
143	-$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(SHAREDLIB_PRE)$(COMPONENT_NAME).*))
144