############################################################################### # File: TOOLSET/csharp.rul[e] # Contents: Visual C/C++ CSHARP rules # #............................................................................# ############################################################################### #.. Remove "undef" warnings # ############################################################################### #.. Parse user options # Global options already parsed # These options extend the global options # ifdef OPTIONS ifneq "$(findstring wall,$(OPTIONS))" "" # Enable all warnings USE_WALL = 1 endif endif ############################################################################### # Standard library paths # Export CS_LIB as this is used by the library generation process to determine # the locations of libraries. cmdfile will use 'CS_LIB" for vglob resolving # process. # # VC_LIB - Lib paths from Compiler toolkit # - ';' seperated path list # - Uses \ or / as a dir sep # - Uses real spaces in pathnames # - Should be Absolute Paths # # LIBDIRS - Lib paths from JATS # - Space seperated path list # - Uses / as dir sep # - Must not contain spaces # - Will be Relative # # ALL_LIBDIRS and LIB # - Only contain valid paths # VS2005 will complain about bad LIB entries # Use $(wildcard ...) to limit to test for existence # - Contain absolute paths # msdev/devenv don't work with relative paths # Use $(abspath ...) to convert # # ALL_LIBDIRS - Used internally # - Space seperated path list # - Uses / as dir sep # - Uses %20 as a altspace in pathnames # # LIB - Exported to tools # - ';' seperated path list # - Uses \ as a dir sep # - Uses real spaces in pathnames #.. vc_libs := $(subst ;,$(space),$(subst \,/,$(subst $(space),$(spacealt),$(VC_LIB)))) ALL_LIBDIRS := $(wildcard $(call myabspath,$(LIBDIRS))) $(vc_libs) CS_LIB := $(subst $(spacealt),$(space),$(subst $(space),$(empty),$(patsubst %,%;,$(subst /,\,$(ALL_LIBDIRS))))) export CS_LIB #one_per_line = $(foreach aa,$2,$(info $1 :: $(subst $(spacealt),$(space),$(aa)))) #$(call one_per_line,Good LIBDIRS,$(ALL_LIBDIRS)) ############################################################################### # #.. Resource Generator # define RESGEN @$(echo) '[$@] Compile Resource ..' @$(show_environment) $(XX_PRE) resgen $(subst /,\\,$(filter %.resx,$^)) $(subst /,\\,$@) endef # #.. CSharp Compiler # Used to create Programs a DLLs # define CSC $(AA_PRE)$(csc_pre) @$(show_environment) $(csc) $(csc_flags) $(csc_o_switch) $(AA_PRE)$(csc_post) endef # # Definitions for the CSharp Compiler Macro # csc_pre - Before the CSC command # csc - The CSC command # csc_flags - Command line options (visible) # csc_o_switch - Command line output options (visible) # csc_post - CSC command cleanup # csc_cmdfile - Name of the generated response file # csc_defines - Local definitions will be placed on cmd line # csc_pre = csc = $(CC_PRE) csc csc_flags = csc_o_switch = @$(csc_cmdfile) csc_post = csc_cmdfile = $(basename $@).ld csc_defines = define csc_pre $(cmdfile) -wkWeo$(csc_cmdfile) \ "$(vc_ldflags)$($(notdir $(basename $@))_ld)"; \ echo '[$@] Compile CSharp Program ..';\ $(call show_cmdfile,$(csc_cmdfile)) endef # # Command line flags # csc_flags += /nologo csc_flags += /out:$@ ifndef ADDLINKLIBS csc_flags += /noconfig endif ifdef NET_PLATFORM csc_flags += /platform:$(NET_PLATFORM) endif ifdef NOWARNLIST csc_flags += /nowarn:$(NOWARNLIST) endif # # Command line flags # ifdef ALVL csc_defines += -DALVL=$(ALVL) endif ifdef DLVL csc_defines += -DDLVL=$(DLVL) endif ifdef USE_WALL csc_flags += /warn:4 else csc_flags += /warn:3 endif ifdef USE_OPTIMISE # default for production csc_flags += # Don't optimise production code. Ship what we test else csc_flags += endif ifdef USE_DEBUGINFO # default for debug csc_flags += /debug /debug:full csc_defines += -DDEBUG else csc_flags += /debug /debug:pdbonly csc_flags += endif ifeq "$(DEBUG)" "1" # debug/prod specific csc_defines += -D_DEBUG else csc_defines += -DNDEBUG endif # # Convert Definitions to a suitable format # Many users use -Dxxxx for Compiler definitions # Maintain this and convert them to a correct form # csc_flags += $(patsubst -D%,/define:%,$(CFLAGS)$(csc_defines)) # # Insert the library search paths into the start of the command file # Create lines of the form: "/lib:" # Put all in quotes to allow for paths with spaces # vc_ldflags = $(subst $(spacealt),$(space),$(patsubst %,\"/lib:%\"\\n,$(subst /,\\\\,$(ALL_LIBDIRS)))) # # Cleanup definitions # ifndef LEAVETMP define csc_post $(rm) -f $(csc_cmdfile) endef else define csc_post endef endif # # Recipes to support the creation of Linker Dependency files # These will generate .dep files # # The dependancy list is based an a makefile definition # The definition is named after the target # define LDDEPEND $(AA_PRE)$(cmdfile) -wkWeo$(@) "$($(DPLIST))" endef define SHLDDEPEND $(AA_PRE)$(cmdfile) -wkWeo$(@) "$($(DPLIST))" endef # # Recipe to create a file that contains the StrongNameKey assembly # Args: $1 Tag of the definitiosn that will go into the file # # define GenSnkWrapper @$(echo) "[$@] Create StrongKey Wrapper.." $(AA_PRE)$(cmdfile) -wkWeo$(@) "$($1)"; endef