Ignore:
Timestamp:
Apr 13, 2002, 6:40:01 AM (23 years ago)
Author:
bird
Message:

Cleanups. Fixed some issues.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/make/process.mak

    r8213 r8253  
    1 # $Id: process.mak,v 1.2 2002-04-07 22:43:25 bird Exp $
     1# $Id: process.mak,v 1.3 2002-04-13 04:39:59 bird Exp $
    22
    33#
     
    1010#
    1111
    12 #
    13 # This makefile expects setup.mak and the specific setup to be included
    14 # already. Plus there are several prerequisite environment variables
    15 # subsystem makefiles need to set:
    16 # TARGET_NAME is obligatory
    17 
    18 !ifndef TARGET_NAME
    19 !error fatal error: TARGET_NAME is not defined!
    20 !endif
    21 
    22 # provide overridable defaults
     12
     13# -----------------------------------------------------------------------------
     14# Assertions.
     15#   This makefile expects setup.mak and the specific setup to be included
     16#   already.
     17#   It also requires the TARGET_NAME to be specified in the makefile.
     18# -----------------------------------------------------------------------------
     19!if "$(MAKE_SETUP_INCLUDED)" != "YES"
     20!error Fatal error: You must include setup.mak before process.mak in the makefile.
     21!endif
     22!if "$(ENV_STATUS)" != "OK"
     23!error Fatal error: The enironment is not valid. Bad setup.mak?
     24!endif
     25
     26!if "$(TARGET_NAME)" == ""
     27!error Fatal error: TARGET_NAME is not defined! Should be set in the makefile.
     28!endif
     29
     30# -----------------------------------------------------------------------------
     31# Provide overridable defaults
     32# -----------------------------------------------------------------------------
     33
     34# Default target mode is executable.
     35!ifndef TARGET_MODE
     36TARGET_MODE = EXE
     37!endif
     38
     39# Default extension corresponds to the target mode.
     40!ifndef TARGET_EXT
     41! if "$(TARGET_MODE)" == "CRT" || "$(TARGET_MODE)" == "DLL"
     42TARGET_EXT  = $(EXT_DLL)
     43! endif
     44! if "$(TARGET_MODE)" == "SYS"
     45TARGET_EXT  = $(EXT_SYS)
     46! endif
     47! if "$(TARGET_MODE)" == "EXE"
     48TARGET_EXT  = $(EXT_EXE)
     49! endif
     50! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "PUBLIB" || "$(TARGET_MODE)" == "SYSLIB"
     51TARGET_EXT  = $(EXT_LIB)
     52! endif
     53! if "$(TARGET_MODE)" == "EMPTY"
     54TARGET_EXT  = empty
     55! endif
     56! ifndef TARGET_EXT
     57!error Error: TARGET_EXT not set
     58! endif
     59!endif
     60
     61# Default target path. (where all the generated stuff for this target goes)
     62!ifndef PATH_TARGET
     63PATH_TARGET = $(PATH_OBJ)\$(TARGET_NAME).$(TARGET_EXT)
     64!endif
     65
     66# Default target file. (output)
    2367!ifndef TARGET
    24 TARGET=$(PATH_TARGET)\$(TARGET_NAME).$(TARGET_EXT)
    25 !endif
    26 
     68TARGET      = $(PATH_TARGET)\$(TARGET_NAME).$(TARGET_EXT)
     69!endif
     70
     71# Default object file. (output)
    2772!ifndef TARGET_OBJS
    28 TARGET_OBJS=$(PATH_TARGET)\$(TARGET_NAME).$(EXT_OBJ)
    29 !endif
    30 
     73TARGET_OBJS = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_OBJ)
     74!endif
     75
     76# Default libraries. (input)
    3177!ifndef TARGET_LIBS
    32 TARGET_LIBS=$(LIB_C_DLL) $(LIB_OS) $(LIB_C_RTDLL)
    33 !endif
    34 
     78TARGET_LIBS = $(LIB_C_DLL) $(LIB_OS) $(LIB_C_RTDLL)
     79!endif
     80
     81# Default definition file. (input)
    3582!ifndef TARGET_DEF
    36 TARGET_DEF=$(MAKEDIR)\$(PATH_DEF)\$(TARGET_NAME).def
    37 !endif
    38 
     83TARGET_DEF  = $(MAKEDIR)\$(PATH_DEF)\$(TARGET_NAME).def
     84!endif
     85
     86# Default definition file for generating the import library. (input)
    3987!ifndef TARGET_IDEF
    40 TARGET_IDEF=$(TARGET_DEF)
    41 !endif
    42 
     88TARGET_IDEF = $(TARGET_DEF)
     89!endif
     90
     91# Default map file. (output)
    4392!ifndef TARGET_MAP
    44 TARGET_MAP=$(PATH_TARGET)\$(TARGET_NAME).map
    45 !endif
    46 
     93TARGET_MAP  = $(PATH_TARGET)\$(TARGET_NAME).map
     94!endif
     95
     96# Default link file. (output)
    4797!ifndef TARGET_LNK
    48 TARGET_LNK=$(PATH_TARGET)\$(TARGET_NAME).lnk
    49 !endif
    50 
    51 !ifndef TARGET_MODE
    52 TARGET_MODE=EXE
    53 !endif
    54 
    55 !ifndef TARGET_EXT
    56 !if "$(TARGET_MODE)" == "CRT" || "$(TARGET_MODE)" == "DLL"
    57 TARGET_EXT=$(EXT_DLL)
    58 !endif
    59 !if "$(TARGET_MODE)" == "SYS"
    60 TARGET_EXT=$(EXT_SYS)
    61 !endif
    62 !if "$(TARGET_MODE)" == "EXE"
    63 TARGET_EXT=$(EXT_EXE)
    64 !endif
    65 !if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "PUBLIB" || "$(TARGET_MODE)" == "SYSLIB"
    66 TARGET_EXT=$(EXT_LIB)
    67 !endif
    68 !if "$(TARGET_MODE)" == "EMPTY"
    69 TARGET_EXT=empty
    70 !endif
    71 !ifndef TARGET_EXT
    72 !error Error: TARGET_EXT not set
    73 !endif
    74 !endif
    75 
     98TARGET_LNK  = $(PATH_TARGET)\$(TARGET_NAME).lnk
     99!endif
     100
     101# Default import library file. (output)
    76102!ifndef TARGET_ILIB
    77 !if "$(TARGET_MODE)" == "CRT" || "$(TARGET_MODE)" == "DLL"
    78 TARGET_ILIB=$(PATH_LIB)\$(TARGET_NAME).$(EXT_ILIB)
    79 !endif
    80 !endif
    81 
    82 !if "$(TARGET_MODE)" == "PUBLIB"
     103! if "$(TARGET_MODE)" == "CRT" || "$(TARGET_MODE)" == "DLL"
     104TARGET_ILIB =$(PATH_LIB)\$(TARGET_NAME).$(EXT_ILIB)
     105! endif
     106!endif
     107
     108# Default public library name. (output)
     109!ifndef TARGET_PUBLIB
     110! if "$(TARGET_MODE)" == "PUBLIB"
    83111TARGET_PUBLIB=$(PATH_LIB)\$(TARGET_NAME).$(TARGET_EXT)
    84 !else
     112! else
    85113TARGET_PUBLIB=
    86 !endif
    87 
    88 
     114! endif
     115!endif
     116
     117# Default depend filename.
     118!ifndef TARGET_DEPEND
     119TARGET_DEPEND = $(PATH_TARGET)\.depend
     120!endif
     121
     122# Default makefile name.
     123!ifndef MAKEFILE
     124MAKEFILE = makefile
     125!endif
     126
     127# Ignore linker warnings for some target modes.
     128!ifndef TARGET_IGNORE_LINKER_WARNINGS
     129! if "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "CRT"
     130TARGET_IGNORE_LINKER_WARNINGS = 1
     131! endif
     132!endif
     133
     134
     135# Default stacksize
     136#
     137# BUGBUG/TODO/FIXME
     138# kso:  Not sure if this is the *right* way to represent it!
     139#       It can't be when we start changing it based on the
     140#       current build environment.
    89141!ifndef TARGET_STACKSIZE
    90142# check if 16-bit target compiler
     
    96148!endif
    97149
    98 !ifndef MAKEFILE
    99 MAKEFILE = makefile
    100 !endif
    101 
    102 
    103 # ensure the platform-specific target path exists
    104 PATH_TARGET=$(PATH_OBJ)\$(TARGET_NAME).$(TARGET_EXT)
    105 !if "$(PATH_TARGET)" != ""
    106 ! if [$(TOOL_EXISTS) $(PATH_TARGET)] != 0
    107 !  if [$(ECHO) Target path $(CLRFIL)$(PATH_TARGET)$(CLRTXT) does NOT exist. Creating. $(CLRRST)]
     150
     151
     152# -----------------------------------------------------------------------------
     153# Tell user what we're building.
     154# -----------------------------------------------------------------------------
     155!ifndef BUILD_QUIET
     156!if [$(ECHO) Target is $(CLRFIL)$(TARGET)$(CLRRST)]
     157!endif
     158!endif
     159
     160
     161# -----------------------------------------------------------------------------
     162# Ensure the platform-specific target path exists
     163# -----------------------------------------------------------------------------
     164
     165!if "$(TARGET_MODE)" != "EMPTY"
     166! if "$(PATH_TARGET)" != ""
     167!  if [$(TOOL_EXISTS) $(PATH_TARGET)] != 0
     168!   ifndef BUILD_QUIET
     169!    if [$(ECHO) Target path $(CLRFIL)$(PATH_TARGET)$(CLRTXT) does NOT exist. Creating. $(CLRRST)]
     170!    endif
     171!   endif
     172!   if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
     173!    error Could not create $(PATH_TARGET)
     174!   endif
    108175!  endif
    109 !  if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
    110 !   error Could not create $(PATH_TARGET)
    111 !  endif
    112 ! endif
    113 !endif
    114 
    115 
    116 # Tell user what we're building.
    117 !if [$(ECHO) Target is $(CLRFIL)$(TARGET)$(CLRRST)]
    118 !endif
    119 
    120 
    121 # build the target filenames
    122 BUILD_TARGET_DEPEND=$(PATH_TARGET)\.depend
    123 
    124 
    125 # ----------------------
    126 # common inference rules
    127 # ----------------------
     176! endif
     177!endif
     178# not 100% sure about the != EMPTY stuff, but this is way faster.
     179
     180
     181
     182# -----------------------------------------------------------------------------
     183# Common inference rules
     184# -----------------------------------------------------------------------------
    128185
    129186.SUFFIXES:
     
    168225        $(CXX_FLAGS_IFS) \
    169226!endif
    170 !ifdef CXX_LST_OUT
     227!if "$(CXX_LST_OUT)" != ""
    171228        $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
    172229!endif
     
    191248        $(CXX_FLAGS_IFS) \
    192249!endif
    193 !ifdef CXX_LST_OUT
     250!if "$(CXX_LST_OUT)" != ""
    194251        $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
    195252!endif
     
    238295        $(CC_FLAGS_IFS) \
    239296!endif
    240 !ifdef CC_LST_OUT
     297!if "$(CC_LST_OUT)" != ""
    241298        $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
    242299!endif
     
    261318        $(CC_FLAGS_IFS) \
    262319!endif
    263 !ifdef CC_LST_OUT
     320!if "$(CC_LST_OUT)" != ""
    264321        $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
    265322!endif
     
    299356
    300357
    301 #
    302 # establish root dependency
    303 # by removing the extension from the BUILD_TARGET
    304 # and replacing it with .obj
    305 #
     358
     359
     360
     361# -----------------------------------------------------------------------------
     362# The all rule - The default one, as it's the first rule in the file.
     363# -----------------------------------------------------------------------------
    306364all: build
    307365
    308366
    309 #
    310 # Build the main target.
    311 #
     367
     368# -----------------------------------------------------------------------------
     369# The build rule - Build the target.
     370#   Must take into account any subdirectories and makefiles which is is to be
     371#   made before and after the target. That makes it kind of messy, sorry.
     372# -----------------------------------------------------------------------------
    312373!ifdef SUBDIRS
    313374SUBDIRS_BUILD = subbuild
     
    329390
    330391
    331 #
    332 # Make Public libraries.
    333 #
     392
     393# -----------------------------------------------------------------------------
     394# The lib rule - Make Public libraries.
     395#   Must take into account any subdirectories and makefiles which is is to be
     396#   made before and after the target. That makes it kind of messy, sorry.
     397# -----------------------------------------------------------------------------
    334398!ifdef SUBDIRS
    335399SUBDIRS_LIB = subdir_lib
     
    350414
    351415
    352 #
    353 # Copies target to main binary directory.
    354 #
     416
     417# -----------------------------------------------------------------------------
     418# The install rule - Copies target to main binary directory.
     419#   Installation order is not concidered vital, so subdirectories and
     420#   pre-makefiles are processed after this directory. This might be changed.
     421# -----------------------------------------------------------------------------
    355422install:
    356423!if "$(TARGET_MODE)" == "EXE"
     
    363430    if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_SYS)
    364431!endif
    365 !if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "PUBLIB" || "$(TARGET_MODE)" == "SYSLIB"
     432!if 0
     433# Nothing to do here currently. These are either private or they're allready where they should be.
     434#
     435# TODO/BUGBUG/FIXME:
     436#       The PUB stuff should be change to a separate variable.
     437#       It will make life easier to just state that this target,
     438#       what ever it is, should be public.
     439#
     440#       That's allow project to install targets during make without
     441#       running the install command by setting some target modes
     442#       public by default.
     443#   (kso)
     444#!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "PUBLIB" || "$(TARGET_MODE)" == "SYSLIB"
    366445#    if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_LIB)
     446#!endif
    367447!endif
    368448!if "$(TARGET_DOCS)" != ""
     
    380460
    381461
    382 #
    383 # Run evt. testcase
    384 #
     462
     463# -----------------------------------------------------------------------------
     464# The testcase rule - Execute testcases when present.
     465#   Testcases are either a testcase.mak file or a testcase subdirectory.
     466# -----------------------------------------------------------------------------
    385467!ifndef BUILD_NO_TESTCASE
    386468testcase: install
     
    403485
    404486
    405 #
    406 # Make dependencies.
    407 #
     487
     488# -----------------------------------------------------------------------------
     489# The dep rule - Make dependencies.
     490# -----------------------------------------------------------------------------
    408491dep:
    409492    @$(ECHO) Building dependencies $(CLRRST)
    410     @$(TOOL_DEP) $(TOOL_DEP_FLAGS) -o$$(PATH_TARGET) -d$(BUILD_TARGET_DEPEND)\
     493    @$(TOOL_DEP) $(TOOL_DEP_FLAGS) -o$$(PATH_TARGET) -d$(TARGET_DEPEND)\
    411494!ifdef TARGET_NO_DEP
    412495        -x$(TARGET_NO_DEP: =;)\
     
    424507
    425508
    426 #
    427 # Clean up output files (not the installed ones).
    428 #
     509
     510# -----------------------------------------------------------------------------
     511# The clean rule - Clean up output files.
     512#   The current setup doesn't clean the installed ones.
     513# -----------------------------------------------------------------------------
    429514clean:
    430515!if "$(PATH_TARGET)" != ""              # paranoia
     
    458543
    459544
    460 #
    461 # EXE, DLL, SYS and IFS Targets
    462 #
     545
     546# -----------------------------------------------------------------------------
     547# The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
     548# -----------------------------------------------------------------------------
    463549!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "CRT" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS"
    464 ! if "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "CRT"
    465 TARGET_IGNORE_LINKER_WARNINGS=1
    466 !endif
    467550$(TARGET): $(TARGET_OBJS) $(TARGET_RES) $(TARGET_DEF) $(TARGET_LNK) $(TARGET_DEPS)
    468551    @$(ECHO) Linking $(TARGET_MODE) $(CLRFIL)$@ $(CLRRST)
     
    471554!endif
    472555!if "$(TARGET_MODE)" == "EXE"
    473     @$(LINK_CMD_EXE)
     556    $(LINK_CMD_EXE)
    474557!endif
    475558!if "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "CRT"
     
    505588
    506589
    507 #
    508 # DLL Import library
    509 #
    510 !ifdef TARGET_ILIB
    511 $(TARGET_ILIB): $(TARGET_IDEF)
    512     @$(ECHO) Creating Import Library $(CLRFIL)$@ $(CLRRST)
    513     $(IMPLIB) $(IMPLIB_FLAGS) $@ $(TARGET_IDEF)
    514 !endif
    515 !endif
    516 
    517 
    518 #
    519 # Lib Targets.
    520 #
     590
     591# -----------------------------------------------------------------------------
     592# The $(TARGET) rule - For LIB, PUBLIB, and SYSLIB targets.
     593# -----------------------------------------------------------------------------
    521594!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "PUBLIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
    522595$(TARGET): $(TARGET_OBJS) $(TARGET_LNK) $(TARGET_DEPS)
     
    542615#
    543616# Copy rule for public libraries.
     617#   BUGBUG/TODO/FIXME: get rid of the PUBLIB stuff. see commet in install.
    544618#
    545619!if "$(TARGET_MODE)" == "PUBLIB"
     
    550624
    551625
    552 #
    553 # Empty target.
    554 #
     626
     627# -----------------------------------------------------------------------------
     628# The $(TARGET) rule - For EMPTY targets.
     629# -----------------------------------------------------------------------------
    555630!if "$(TARGET_MODE)" == "EMPTY"
    556631$(TARGET):
     
    559634
    560635
    561 #
    562 # read dependency file from current directory
    563 #
     636
     637# -----------------------------------------------------------------------------
     638# The $(TARGET_ILIB) rule - Make import library.
     639# -----------------------------------------------------------------------------
     640!ifdef TARGET_ILIB
     641$(TARGET_ILIB): $(TARGET_IDEF)
     642    @$(ECHO) Creating Import Library $(CLRFIL)$@ $(CLRRST)
     643    $(IMPLIB) $(IMPLIB_FLAGS) $@ $(TARGET_IDEF)
     644!endif
     645!endif
     646
     647
     648
     649# -----------------------------------------------------------------------------
     650# The .force rule - Force a remake of something everytime.
     651# -----------------------------------------------------------------------------
     652.force:
     653    @$(ECHO) .
     654
     655
     656
     657# -----------------------------------------------------------------------------
     658# Read Dependencies.
     659# -----------------------------------------------------------------------------
     660
    564661!if "$(TARGET_MODE)" != "EMPTY"
    565 ! if [$(TOOL_EXISTS) $(BUILD_TARGET_DEPEND)] == 0
    566 !  if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_TARGET_DEPEND)$(CLRRST)]
     662
     663#
     664# Read dependency file for current directory
     665#
     666!if [$(TOOL_EXISTS) $(TARGET_DEPEND)] == 0
     667! ifndef BUILD_QUIET
     668!  if [$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)]
    567669!  endif
    568 !  include $(BUILD_TARGET_DEPEND)
     670! endif
     671! include $(TARGET_DEPEND)
     672!else
     673! ifndef NODEP
     674!   if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)]
     675!   endif
     676! endif
     677!endif
     678
     679
     680#
     681# Read global dependency files.
     682#
     683!ifdef BUILD_DEPEND1
     684! if [$(TOOL_EXISTS) $(BUILD_DEPEND1)] == 0
     685!  ifndef BUILD_QUIET
     686!   if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)]
     687!   endif
     688!  endif
     689!  include $(BUILD_DEPEND1)
    569690! else
    570691!  ifndef NODEP
    571 !    if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_TARGET_DEPEND) is missing.$(CLRRST)]
     692!    if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)]
    572693!    endif
    573694!  endif
     
    575696!endif
    576697
    577 
    578 #
    579 # Force rule.
    580 #
    581 .force:
    582     @$(ECHO) .
    583 
     698!ifdef BUILD_DEPEND2
     699! if [$(TOOL_EXISTS) $(BUILD_DEPEND2)] == 0
     700!  ifndef BUILD_QUIET
     701!   if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)]
     702!   endif
     703!  endif
     704!  include $(BUILD_DEPEND2)
     705! else
     706!  ifndef NODEP
     707!    if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)]
     708!    endif
     709!  endif
     710! endif
     711!endif
     712
     713
     714!ifdef BUILD_DEPEND3
     715! if [$(TOOL_EXISTS) $(BUILD_DEPEND3)] == 0
     716!  ifndef BUILD_QUIET
     717!   if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)]
     718!   endif
     719!  endif
     720!  include $(BUILD_DEPEND3)
     721! else
     722!  ifndef NODEP
     723!    if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)]
     724!    endif
     725!  endif
     726! endif
     727!endif
     728
     729
     730!endif
     731
Note: See TracChangeset for help on using the changeset viewer.