2 # This is helper makefile that can build DLL or EXE for i386, amd64 or ia64 platform.
3 # User of the makefile should specify the following symbols:
4 # * DEBUG (1/0) - iff a debug version of the binary should be build (0 by default)
5 # * TARGET - base name of the binary (ex.: cxcore, cv, ml, cvtest etc.)
6 # * BINTYPE (DLL/CONSOLE/APP) - the type of application (dll/console app/app with gui), dll by default
7 # * ROOT - the relative path to the root opencv directory
8 # * OBJS - the list of object files, each file must be preceded with $(OBJPATH)\
9 # * INCS - the list of include files
10 # * CXX - the compiler to be used (cl by default)
11 # * CXXFLAGS_PROJ - the initial compiler options
12 # (some project-specific defines and the list of include directories)
13 # * LIBS_PROJ - the initial linker options
14 # (the list of linked libraries + path to the libraries)
15 # * RES_FILE - resource file, if any
36 !if "$(BINTYPE)"=="DLL"
43 CXXFLAGS_DLL = -D"CVAPI_EXPORTS"
51 !if "$(BINTYPE)"=="CONSOLE"
53 !else if "$(BINTYPE)"=="APP"
67 CXXFLAGS_DBG = -D"_DEBUG" -Od -v
68 TEMP_DBG_SUFFIX = _Dbg
73 CXXFLAGS_DBG = -D"NDEBUG" -O2 -v
74 TEMP_DBG_SUFFIX = _Rls
79 OBJPATH = $(ROOT)\_temp\$(TARGET)$(TEMP_DBG_SUFFIX)_bcc
80 OUTBIN = $(ROOT)\bin\$(TARGET)$(VER)$(DBG)$(EXT)
81 OUTLIB = $(ROOT)\lib\$(TARGET)$(DBG).lib
82 LIBS = kernel32.lib user32.lib gdi32.lib advapi32.lib
87 CXXFLAGS = -q -3 -a8 -b -c -d -RT- -tWM -tW -w-inl -w-aus -j200 -D"WIN32" -D"_WINDOWS" $(CXXFLAGS_DLL) $(CXXFLAGS_DBG) $(CXXFLAGS_PROJ) -o
88 LINKFLAGS = -q -lq -v -lv -e$(OUTBIN) $(LINKFLAGS_DLL) $(LIBS_PROJ) $(MY_LINKFLAGS)
95 .path.cpp = $(SRCPATH)
96 .path.obj = $(OBJPATH)
100 !if "$(BINTYPE)"=="DLL"
103 @echo ********* Linking $(TARGET) ...
104 @-mkdir $(ROOT)\bin 2> nul
105 @-mkdir $(ROOT)\lib 2> nul
106 @$(LINK) $(LINKFLAGS) $** $(LIBS)
107 @implib $(OUTLIB) $(OUTBIN)
112 @echo ********* Linking $(TARGET) ...
113 @-mkdir $(ROOT)\bin 2> nul
114 @$(LINK) $(LINKFLAGS) $** $(LIBS)
119 @-mkdir $(OBJPATH) 2> nul
120 @$(CXX) $(CXXFLAGS)"$@" $<
123 @-mkdir $(OBJPATH) 2> nul
124 @$(CXX) $(CXXFLAGS)"$@" $<
130 @-del $(OUTBIN) 2> nul
131 @-del $(OUTPDB) 2> nul
132 @-del $(OUTLIB) 2> nul
133 @-rmdir /s /q $(OBJPATH) 2> nul