Rev 335 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
################################################################################ 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 OPTIONSifneq "$(findstring wall,$(OPTIONS))" "" # Enable all warningsUSE_WALL = 1endifendif################################################################################ 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) csccsc_flags =csc_o_switch = @$(csc_cmdfile)csc_post =csc_cmdfile = $(basename $@).ldcsc_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 += /nologocsc_flags += /out:$@ifndef ADDLINKLIBScsc_flags += /noconfigendififdef NET_PLATFORMcsc_flags += /platform:$(NET_PLATFORM)endififdef NOWARNLISTcsc_flags += /nowarn:$(NOWARNLIST)endif## Command line flags#ifdef ALVLcsc_defines += -DALVL=$(ALVL)endififdef DLVLcsc_defines += -DDLVL=$(DLVL)endififdef USE_WALLcsc_flags += /warn:4elsecsc_flags += /warn:3endififdef USE_OPTIMISE # default for productioncsc_flags += # Don't optimise production code. Ship what we testelsecsc_flags +=endififdef USE_DEBUGINFO # default for debugcsc_flags += /debug /debug:fullcsc_defines += -DDEBUGelsecsc_flags += /debug /debug:pdbonlycsc_flags +=endififeq "$(DEBUG)" "1" # debug/prod specificcsc_defines += -D_DEBUGelsecsc_defines += -DNDEBUGendif## 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:<pathname>"# Put all in quotes to allow for paths with spaces#vc_ldflags = $(subst $(spacealt),$(space),$(patsubst %,\"/lib:%\"\\n,$(subst /,\\\\,$(ALL_LIBDIRS))))## Cleanup definitions#ifndef LEAVETMPdefine csc_post$(rm) -f $(csc_cmdfile)endefelsedefine csc_postendefendif## 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))"endefdefine 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