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