# CONFIG.WIN32 -kuk- # # The current make-system for WIN32 # needs # * gnumake (OK, sources for WIN32 are available) # * Perl (e.g. from www.perl.com ) # # Use std path variables from ms HOME = $(HOMEDRIVE)$(HOMEPATH) # BUILD_TYPE # Currently either Vx or Host (latter used to be Unix BUILD_TYPE=Host # # global WIN32 optimize/debug flag # (set this to NO in $(HOME)/EPICS_CONFIG if you need to compile # in debug info) # HOST_OPT = YES # -Ox : maximum optimizations # -Wn : use this warning level (all warnings at level 4) # -MD : use MSVCRT (run-time as DLL, multi-thread support) CXX_OPT_FLAGS_YES = -Ox -W3 -MD # -Zi : include debugging info in object files # -MDd : use MSVCRTD (debug, multi-thread support) CXX_OPT_FLAGS_NO = -Zi -W3 -MDd CXX_OPT_FLAGS = $(CXX_OPT_FLAGS_$(HOST_OPT)) LINK_OPT_FLAGS_YES = LINK_OPT_FLAGS_NO = -debug LINK_OPT_FLAGS = $(LINK_OPT_FLAGS_$(HOST_OPT)) # to identify the general architecture class: # should be BSD, SYSV, WIN32, ... # is: WIN32, sun4, hpux, linux, ... # ARCH_CLASS=WIN32 # ifdef WIN32 looks better that ifeq ($(ARCH_CLASS),WIN32) ?? WIN32=1 # Compiler and utility invocation (supply path to compiler here) # (with warning flags built in) # Paths to compilers YACC = $(EYACC) LEX = $(ELEX) CC = cl -nologo CXX = cl -nologo ARCMD = lib -nologo -verbose -out:$@ CP = $(PERL) $(INSTALL_BIN)/cp.pl MV = $(PERL) $(INSTALL_BIN)/mv.pl RM = $(PERL) $(INSTALL_BIN)/rm.pl -f MKDIR = $(PERL) $(INSTALL_BIN)/mkdir.pl RMDIR = $(PERL) $(INSTALL_BIN)/rm.pl -rf ECHO = echo EXE=.exe OBJ=.obj # Include files HOST_INCLUDES = -I. -I.. $(USR_INCLUDES) -I$(INSTALL_INCLUDE) \ -I$(EPICS_BASE_INCLUDE) -I$(EPICS_BASE_INCLUDE)/os/$(ARCH_CLASS) # Operating system flags (from win32.mak) # # __STDC__=0 is a real great idea of Jeff that gives us both: # 1) define STDC for EPICS code (pretend ANSI conformance) # 2) set it to 0 to use MS C "extensions" (open for _open etc.) # because MS uses: if __STDC__ ... disable many nice things # # Unable to use -Za to turn on __STDC__ because there are # non-standard constructs in winnt.h etc # OP_SYS_FLAGS = -D__STDC__=0 HOST_LDLIBS = user32.lib kernel32.lib wsock32.lib advapi32.lib winmm.lib HOST_LDFLAGS = -nologo # Files and flags needed to link DLLs (used in RULES.Host) # # Strange but seems to work without: WIN32_DLLFLAGS should contain # an entry point: # '-entry:_DllMainCRTStartup$(DLLENTRY)' DLLENTRY = @12 # yes, for MS it's I386 for 386, 486, Pentium! # don't mix this with VxWorks which has different BSPs for [34]86 ! WIN32_DLLFLAGS = $(HOST_LDFLAGS) \ -subsystem:windows -dll -incremental:no $(LINK_OPT_FLAGS) -machine:I386 ARCH_DEP_CFLAGS = ARCH_DEP_CXXFLAGS = $(ARCH_DEP_CFLAGS) HOST_CFLAGS = $(HOST_SFLAGS) $(HOST_INCLUDES) $(OP_SYS_FLAGS) $(CXX_OPT_FLAGS) HOST_CXXFLAGS = $(HOST_CFLAGS) # Target specific flags TARGET_CFLAGS = $($(basename $@)_CFLAGS) TARGET_CXXFLAGS = $($(basename $@)_CXXFLAGS) TARGET_CPPFLAGS = $($(basename $@)_CPPFLAGS) TARGET_LDFLAGS = $($(basename $@)_LDFLAGS) TARGET_LDLIBS = $($(basename $@)_LDLIBS) TARGET_SNCFLAGS = $($(basename $@)_SNCFLAGS) CFLAGS = $(HOST_OPT_FLAGS) $(TARGET_CFLAGS) $(USR_CFLAGS) $(ARCH_DEP_CFLAGS) $(HOST_CFLAGS) CXXFLAGS = $(HOST_OPT_FLAGS) $(TARGET_CXXFLAGS) $(USR_CXXFLAGS) $(ARCH_DEP_CXXFLAGS) $(HOST_CXXFLAGS) CPPFLAGS += $(TARGET_CPPFLAGS) $(USR_CPPFLAGS) LDFLAGS = $(SPECIAL_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(ARCH_DEP_LDFLAGS) $(HOST_LDFLAGS) LDLIBS = $(TARGET_LDLIBS) $(USR_LDLIBS) $(ARCH_DEP_LDLIBS) $(HOST_LDLIBS) DLL_LDLIBS = $(DLL_DEP_LIBS) $(ARCH_DEP_LDLIBS) $(HOST_LDLIBS) # Override SUN defaults COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c # Problem: MS Visual C++ does not recognize *.cc as C++ source, # we have to compile xx.cc using the flag -Tp xx.cc, # i.e. -Tp has to be immediately before the source file name COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -Tp LINK.c = link $(LINK_OPT_FLAGS) $(LDFLAGS) -out:$@ LINK.cc = $(LINK.c) # # specify dll .def file only if it exists # DLL_DEF_FLAG = $(addprefix -def:,$(wildcard ../$(LIBRARY).def)) # HOST_OPT_FLAGS is part of CFLAGS/CXXFLAGS, # which in turn are used in COMPILE.c[c] # # If we compile a .c, .cc into an $(OBJ), # we test if this object is part of the # library objects LIBOBJS. # If so, we define _WINDLL so that # e.g. include/shareLib.h works correctly. # HOST_OPT_FLAGS += $(subst $@, -D_WINDLL, $(findstring $@,$(LIBOBJS))) # # A WIN32 dll has three parts: # x.dll: the real dll (DLLNAME) # x.lib: what you link to progs that use the dll (LIBNAME) # x.exp: what you need to build the dll (in no variable) # LINK.dll = link $(WIN32_DLLFLAGS) -implib:$(@:%.dll=%.lib) -out:$@ $(DLL_DEF_FLAG) # The DEPENDS_RULE may be a script on other systems, # if you need different rules for .c and .cc, # that script has to figure out what to call. # DEPENDS_RULE = @echo no DEPENDS_RULE defined in CONFIG.WIN32 # adjust names of libraries to build # # But: if there are no objects LIBOBJS to include # in this library (may be for e.g. base/src/libCompat # on some archs), don't define (and build) any library! DLLNAME = $(LIBRARY).dll # libs defined that we need to link the DLL with DLL_DEP_LIBS = $(DLL_LIBS:%=$(INSTALL_LIB)/%.lib) LIBNAME = $(LIBRARY).lib PRODDEPLIBS = $(PROD_LIBS:%=$(INSTALL_LIB)/%.lib) USR_LDLIBS += $(PRODDEPLIBS) SYSPRODDEPLIBS = # ???????? unimplemented dependency USR_LDLIBS += $(SYSPRODDEPLIBS)