Rev 227 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
# -*- mode: mak; -*-############################################################################### Copyright (c) VIX TECHNOLOGY (AUST) LTD## File: TOOLSET/pd386.rul[e]# Contents: Paradigm/386 rules## Revision History:# 20/02/02 APY Created# 26/02/02 APY Added depend post processing to append OBJDIR# 27/02/02 APY ; appended to several directives, forcing use of# exe' during execution. Required by WIN32# toolsets (see xx_term variables),# 09/04/02 - __PARADIGM__ defined within asm sessions# - trimmed white space# 20/04/02 - realpath() usage required by debugger.#############################################################################################################################################################.. Remove "undef" warnings#cc_includes +=cc_defines +=cxx_includes +=cxx_defines +=as_includes +=as_defines +=################################################################################.. C Compiler definition# Paradigm C++ 6.00.003 Copyright (c) 1998, 2001 Paradigm Systems.# Syntax is: PCC32 [ options ] file[s] * = default; -x- = turn switch x off# -3 * 80386 Instructions -4 80486 Instructions# -Ax Disable extensions -B Compile via assembly# -C Allow nested comments -Dxxx Define macro# -Exxx Alternate Assembler name -Hxxx Use pre-compiled headers# -Ixxx Include files directory -K Default char is unsigned# -Lxxx Libraries directory -M Generate link map# -N Check stack overflow -Ox Optimizations# -P Force C++ compile -R Produce browser info# -RT * Generate RTTI -S Produce assembly output# -Txxx Set assembler option -Uxxx Undefine macro# -Vx Virtual table control -X Suppress autodep. output# -aN Align on N bytes -b * Treat enums as integers# -c * Compile only -d Merge duplicate strings# -exxx Executable file name -fxx Floating point options# -gN Stop after N warnings -iN Max. identifier length# -jN Stop after N errors -k * Standard stack frame# -lx Set linker option -nxxx Output file directory# -oxxx Object file name -p Pascal calls# -tWxxx Create Windows app -u * Underscores on externs# -v Source level debugging -wxxx Warning control# -xxxx Exception handling -y Produce line number info# -zxxx Set segment names#cc = @pcc32cc_init =cc_o_switch =cc_source =cc_cmdfile = $(subst /,\\,$(basename $@).cmd)cc_flags = @$(cc_cmdfile)cc_term = ; # ; force use of 'sh.exe'pd_includes += $(paradigm)/include# Options:## -f- no floating point# -j# stop after # errors# -v generate debug information# -0x optimisation# -w Enable warnings# -w-aus suppress warning for unused variables# -w-par suppress warning for unused function parameters# -w-pro suppress warning for function pointer without protoype#pd_flags = -c -w -j50 -D__STDC__=1pd_flags += -f- -Huifeq "$(DEBUG)" "1"pd_flags += -Od -r- -v -R -DDEBUGelseifdef PD_NOOPTIMpd_flags += -Od -r- -velsepd_flags += -O2 -X -w-aus -w-par -w-proendifendififdef ALVLpd_flags += -DALVL=$(ALVL)endififdef DLVLpd_flags += -DDLVL=$(DLVL)endifpd_flags += -D__SOURCE__=\"$(notdir $<)\"pd_flags += -D__LOCATE32__define cc_pre@echo [\$<] compiling..@$(cmdfile) -ko$(cc_cmdfile) "\$(patsubst %,%\\n,$(pd_flags)) \$(patsubst %,%\\n,$(CFLAGS)) \$(patsubst %,-D%\\n,$(cc_defines)) \$(patsubst %,-I%\\n,$(subst /,\\\\,$(INCDIRS))) \$(patsubst %,-I%\\n,$(subst /,\\\\,$(cc_includes))) \$(patsubst %,-I%\\n,$(subst /,\\\\,$(pd_includes))) \$(subst /,\\\\,-o$@)\\n\@(realpath,$(subst /,\\,$<))"endefifndef LEAVETMPdefine cc_post@$(rm) -f $(cc_cmdfile)endefelsedefine cc_postendefendif################################################################################.. C/C++ dependencies# depend and depend.err#pd_depend = -D__PARADIGM__=600 -D__STDC__pd_depend += -D__BORLANDC__=0x530 -D__TURBOC__=0x530pd_depend += -D__386__ -D_M_IX86pd_depend += -DMSDOS -D__MSDOS__ -D__DOS__ifeq "$(DEBUG)" "1"pd_depend += -DDEBUGelsepd_depend += -D__PCOPT__endififdef ALVLpd_depend += -DALVL=$(ALVL)endififdef DLVLpd_depend += -DDLVL=$(DLVL)endifpd_depend += -D__SOURCE__=\"$(notdir $<)\"ccdep = @$(SCM_BIN)/mkdependccdep_init =ccdep_o_switch = -f -ccdep_source = $(filter %.c %.cc %.cpp, $+) > $(subst /,/,$@).tmp 2> $@.errccdep_flags = -MM \$(patsubst %,%,$(CFLAGS)) \$(patsubst %,-D%,$(cc_defines)) \$(patsubst %,%,$(pd_depend)) \$(patsubst %,-I %,$(INCDIRS)) \$(patsubst %,-Y %,$(cc_includes)) \$(patsubst %,-Y %,$(pd_includes)) \$(patsubst %,-Y %,$(NODEPDIRS))ccdep_pre =define ccdep_post-sed s/\^/\$$\(OBJDIR\)\\// $(subst /,/,$@).tmp | grep \\.${o} > $(subst /,/,$@)@rm $(subst /,/,$@).tmpendef#.. C++ Compiler definition#cxx = @pcc32cxx_init =cxx_o_switch = -Pcxx_object = -o$@cxx_source =cxx_cmdfile = $(subst /,\\,$(basename $@).cmd)cxx_flags = @$(cxx_cmdfile)cxx_term = ; # ; force use of 'sh.exe'define cxx_pre@echo [\$<] compiling..@$(cmdfile) -ko$(cxx_cmdfile) "\$(patsubst %,%\\n,$(CXXFLAGS)) \$(patsubst %,-D%\\n,$(cxx_defines)) \$(patsubst %,%\\n,$(pd_flags)) \$(patsubst %,-I%\\n,$(subst /,\\\\,$(INCDIRS))) \$(patsubst %,-I%\\n,$(subst /,\\\\,$(cxx_includes))) \$(patsubst %,-I%\\n,$(subst /,\\\\,$(pd_includes))) \$(subst /,\\\\,$(cxx_object))\\n\@(realpath,$(subst /,\\,$<))"endefifndef LEAVETMPdefine cxx_post@$(rm) -f $(cxx_cmdfile)endefelsedefine cxx_postendefendif################################################################################.. Assembler definition## PASM32 [options] source [,object] [,listing] [,xref]# /a,/s Alphabetic or Source-code segment ordering# /c Generate cross-reference in listing# /dSYM[=VAL] Define symbol SYM = 0, or = value VAL# /e,/r Emulated or Real floating-point instructions# /h,/? Display this help screen# /iPATH Search PATH for include files# /jCMD Jam in an assembler directive CMD (eg. /jIDEAL)# /kh# Hash table capacity # symbols# /l,/la Generate listing: l=normal listing, la=expanded listing# /ml,/mx,/mu Case sensitivity on symbols: ml=all, mx=globals, mu=none# /mv# Set maximum valid length for symbols# /m# Allow # multiple passes to resolve forward references# /n Suppress symbol tables in listing# /p Check for code segment overrides in protected mode# /q Suppress OBJ records not needed for linking# /t Suppress messages if successful assembly# /uxxxx Set version emulation, version xxxx# /w0,/w1,/w2 Set warning level: w0=none, w1=w2=warnings on# /w-xxx,/w+xxx Disable (-) or enable (+) warning xxx# /x Include false conditionals in listing# /z Display source line with error message# /zi,/zd,/zn Debug info: zi=full, zd=line numbers only, zn=none#as = @pasm32as_init =as_flags = @$(as_cmdfile)as_o_switch =as_object = $(subst /,\\,$@)as_list = $(subst /,\\,$(basename $@).lst)as_source = $(subst /,\\,$<) ,$(as_object) ,$(as_list)as_cmdfile = $(subst /,\\,$(basename $@).cmd)as_term = ; # ; force use of 'sh.exe'as_i_switch = /ias_includes += $(paradigm)/includepasm_flags = /c /ml /tifeq "$(DEBUG)" "1"pasm_flags += /w2 /zi /DDEBUGendifpasm_flags += /D__PARADIGM__ # Target C/C++ compilerifdef DLVLpasm_flags += /DDLVL=$(DLVL)endififdef ALVLpasm_flags += /DALVL=$(ALVL)endifas_defines := $(addprefix /D,$(as_defines))as_defines += $(pasm_flags)define as_pre@$(cmdfile) -ko$(as_cmdfile) "\$(patsubst %,%\\n,$(ASFLAGS)) \$(patsubst %,%\\n,$(as_defines)) \$(patsubst %,$(as_i_switch)%\\n,$(subst /,\\\\,$(INCDIRS))) \$(patsubst %,$(as_i_switch)%\\n,$(subst /,\\\\,$(as_includes)))"endefifndef LEAVETMPdefine as_post@$(rm) -f $(as_cmdfile)endefelsedefine as_postendefendif#.. Archiver (AR)## /C case-sensitive symbol support# /E create an extended dictionary# /P page size#ar = @plibar_init =ar_cmdfile = $(subst /,\\,$(basename $@).ar)ar_flags = /E /P512ar_o_switch = $(subst /,\\,$@) @$(ar_cmdfile)ar_term = ; # ; force use of 'sh.exe'define ar_pre@$(cmdfile) -ko$(ar_cmdfile) \$(patsubst %,+% \&\\n,$(subst /,\\\\,$^)) \,$(subst /,\\,$(basename $@).lst); \$(rm) -f $@endefifndef LEAVETMPdefine ar_post@$(rm) -f $(ar_cmdfile)endefelsedefine ar_postendefendif#.. Linker (LD)## PLINK32 objfiles, exefile, mapfile, libfiles, deffile, resfiles# @xxxx indicates use response file xxxx# -m Map file with publics -x No map# -s Detailed segment map -L Specify library search paths# -M Map with mangled names -j Specify object search paths# -c Case sensitive link -v Full symbolic debug information# -Enn Max number of errors -n No default libraries# -P- Disable code packing -H:xxxx Specify app heap reserve size# -B:xxxx Specify image base addr -Hc:xxxx Specify app heap commit size# -wxxx Warning control -S:xxxx Specify app stack reserve size# -Txx Specify output file type -Sc:xxxx Specify app stack commit size# -Tpx PE image -Af:nnnn Specify file alignment# (x: e=EXE, d=DLL) -Ao:nnnn Specify object alignment# -ax Specify application type -o Import by ordinals# -ap Windowing Compatible -Vd.d Specify Windows version# -aa Uses Windowing API -r Verbose link## Now the fun part... piecing together a variable $(name_ld)# which ends up in the command file.#ld = @plink32ld_cmdfile = $(subst /,\\,$(basename $@).ld)ld_flags = @$(ld_cmdfile)ld_o_switch =ld_term = ; # ; force use of 'sh.exe'plink_flags += -s # Detailed segment mapplink_flags += -n # No default librariesplink_flags += -c # Case sensitive linkplink_flags += -Tpe # PE styleifeq "$(DEBUG)" "1"plink_flags += -v # Full symbolic debug informationendifdefine ld_pre@echo [\$@] linking..@export PD386_LIB; \PD386_LIB="$(subst $(space),;,$(LIBDIRS))"; \$(cmdfile) -ko$(ld_cmdfile) "\$(patsubst %,% +\\n,$(plink_flags)) \$($(notdir $(basename $@))_ld)"endefifndef LEAVETMPdefine ld_post@$(rm) -f $(ld_cmdfile)endefelsedefine ld_postendefendifdefine LDDEPEND@export PD386_LIB; \PD386_LIB="$(subst $(space),;,$(LIBDIRS))"; \$(cmdfile) -ko$(BINDIR)/$(notdir $(basename $@)).dep \"$($(notdir $(basename $@))_dp)"endef#.. Locate (LD2 - Linker 2nd phase)## Usage: LOCATE32 [Options] Application [ConfigFile...]## As the locate32 command line interface is limited to# explicit arguments without '@' command file support and# to allow the section configuration file to be resolved# a link time, we must locate the config file during the# ld2_pre stage.#..ld2 = locate32ld2_config = $(basename $@).cfgld2_flags = $(LOCATEOPT)ld2_term = ; # ; force use of 'sh.exe'define ld2_pre@echo [\$@] locating..@export LOCATE32_CFG; \LOCATE32_CFG="$(subst $(space),;,.;$(INCDIRS))"; \$(cmdfile) -ko$(ld2_config) \"@(vpath2,$(LOCATECFG),LOCATE32_CFG)\\n"endefifndef LEAVETMPdefine ld2_post@$(rm) -f $(ld2_config)endefelsedefine ld2_postendefendifdefine LD2@$(show_environment)$(ld2_pre)$(ld2) $(ld2_flags) $< `cat $(ld2_config)` $(ld2_term)$(ld2_post)endef#