xref: /trunk/main/odk/examples/OLE/activex/Makefile (revision 122c3632)
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 OLE activex C++ component 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
32COMPONENT_NAME=so_activex
33COMPONENT_IMPL_NAME=$(SHAREDLIB_PRE)$(COMPONENT_NAME).$(SHAREDLIB_EXT)
34COMPONENT_IMPL=$(SHAREDLIB_OUT)/$(SHAREDLIB_PRE)$(COMPONENT_NAME).$(SHAREDLIB_EXT)
35OUT_COMP_INC = $(OUT_INC)/$(COMPONENT_NAME)
36OUT_COMP_GEN = $(OUT_MISC)/$(COMPONENT_NAME)
37OUT_COMP_SLO=$(OUT_SLO)/$(COMPONENT_NAME)
38
39MIDLFILES = so_activex.idl
40
41CXXFILES = SOActiveX.cpp \
42	 SOComWindowPeer.cpp \
43	 so_activex.cpp \
44	 StdAfx2.cpp
45
46SLOFILES = $(patsubst %.cpp,$(OUT_COMP_SLO)/%.$(OBJ_EXT),$(CXXFILES))
47
48# Targets
49.PHONY: ALL
50ALL : \
51	OleActvieXComponentExample
52
53include $(SETTINGS)/stdtarget.mk
54
55# Attention: so_activex.idl is no UNOIDL file!
56$(OUT_COMP_INC)/so_activex.h : so_activex.idl
57	-$(MKDIR) $(subst /,$(PS),$(@D))
58	-$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN))
59	midl.exe /tlb $(OUT_COMP_GEN)/so_activex.tlb /h $(OUT_COMP_INC)/so_activex.h \
60	/iid $(OUT_COMP_INC)/so_activex_i.c /proxy $(OUT_COMP_INC)/so_activex_p.c \
61	/dlldata $(OUT_COMP_INC)/dlldata.c /Oicf $<
62
63$(OUT_COMP_GEN)/so_activex.res : so_activex.rc $(OUT_COMP_INC)/so_activex.h
64	-$(MKDIR) $(subst /,$(PS),$(@D))
65	rc $(CC_INCLUDES) /R /FO$@ so_activex.rc
66
67$(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cpp
68	-$(MKDIR) $(subst /,$(PS),$(@D))
69	$(CC) $(CC_FLAGS) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $<
70
71
72# Note: If you don't use the MS Visual Studio .Net, please comment out the next line.
73CL_NEW_LIB=atls.lib
74
75$(SHAREDLIB_OUT)/$(SHAREDLIB_PRE)%.$(SHAREDLIB_EXT) : $(SLOFILES) $(OUT_COMP_GEN)/so_activex.res so_activex.def
76	-$(MKDIR) $(subst /,$(PS),$(@D))
77	-$(MKDIR) $(subst /,$(PS),$(OUT_LIB))
78	@echo .
79	@echo -----------------------------------------------------------------------------------
80	@echo ATTENTION: If you have problems with linking the library and if you do not use the
81	@echo MS .Net compiler please check the makefile and comment out the variable CL_NEW_LIB.
82	@echo -----------------------------------------------------------------------------------
83	@echo .
84	$(LINK) $(LIBRARY_LINK_FLAGS) /OUT:$@ /MAP:$(OUT_COMP_GEN)/$(subst $(SHAREDLIB_EXT),map,$(@F)) \
85	/DEF:so_activex.def /IMPLIB:$(OUT_LIB)/iso_activex.lib $(SLOFILES) \
86	msvcrt.lib kernel32.lib user32.lib uuid.lib advapi32.lib ole32.lib oleaut32.lib gdi32.lib \
87	urlmon.lib Shlwapi.lib oldnames.lib $(CL_NEW_LIB) $(OUT_COMP_GEN)/so_activex.res
88	$(LINK_MANIFEST)
89
90ifeq "$(OS)" "WIN"
91OleActvieXComponentExample : $(COMPONENT_IMPL)
92	@echo --------------------------------------------------------------------------------
93	@echo The activex control was created, please load the "$(QM)example.html$(QM)" file
94	@echo in your InternetExplorer to use the activex control.
95	@echo --------------------------------------------------------------------------------
96else
97OleActvieXComponentExample :
98	@echo --------------------------------------------------------------------------------
99	@echo This example works only under Windows!
100	@echo --------------------------------------------------------------------------------
101endif
102
103.PHONY: clean
104clean :
105	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC))
106	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN))
107	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO))
108	-$(DEL) $(subst \\,\,$(subst /,$(PS),$(OUT_LIB)/*$(COMPONENT_NAME).*))
109	-$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(SHAREDLIB_PRE)$(COMPONENT_NAME).*))
110