view src/gpf2/frame/cust_os/makefile @ 34:b65a942e49ce

cst.lib done
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 30 Sep 2016 17:30:04 +0000
parents 864b8cc0cf63
children
line wrap: on
line source

#######################  Makefile for GNU make    #####################
#                                                                     
#           makefile to build cust.lib 
#                                             
#           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~               
#           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~               
#                                                                     
#           targets:  
#
#           osx.lib    functions which belong neither to frame nor to tif, somehow old files
#           clean          delete temp files                           
#                                                                     
#######################################################################

OWN_MAKELEVEL=0

#---------- Directories
# to add the right header file for the specified board type
BOARD=5

ifdef TOOL_CHOICE
  TS:=/ts$(TOOL_CHOICE)
  tsTail  :=_ts$(TOOL_CHOICE)
else
  TS:=
endif

ifdef PATH_CC_1_22E 
 PATH:=$(PATH_CC_1_22E);$(PATH)
 C_DIR:=$(PATH_CC_1_22E)
endif

ifeq ($(TOOL_CHOICE), 3)
 COPTS= --align_structs=4 -pden -o -q
 ifndef PATH_CC_2_54 
   PATH_CC_2_54=C:/Dvpt_tools/Codegen/TMS4701x_2.54
 endif
 Path:=$(PATH_CC_2_54)/bin;$(Path)
 INCLUDES += -I"$(PATH_CC_2_54)/include"
endif

ifeq ($(TOOL_CHOICE), 5)
 COPTS= --align_structs=4 -pden -o -q
 ifndef PATH_CC_2_55 
   PATH_CC_2_55=C:\Dvpt_tools\Codegen\TMS4701x_2.55
 endif
 Path:=$(PATH_CC_2_55)/bin;$(Path)
 INCLUDES += -I"$(PATH_CC_2_55)/include"
endif

ifeq ($(TOOL_CHOICE), 6)
  # --code_state=16 => -mt
  # --endian=little => -me
  # what is -ml?
  COPTS= -mv=5e --abi=ti_arm9_abi
  COPTS+= -pden -pdv -mf -ms -qq -disable_branch_chaining -pi
  ifndef PATH_CC_4_11 
    PATH_CC_4_11=C:\Dvpt_tools\Codegen\TMS4701x_4.11
  endif
  Path:=$(PATH_CC_4_11)/bin;$(Path)
  INCLUDES += -I"$(PATH_CC_4_11)/include"
endif

# for created object files
ifeq ($(TARGET), nuc)
  OBJDIR=obj/$(TARGET)/$(PLATFORM)$(DB)$(OSAL)$(PS)$(OPT)$(TS)
else
  OBJDIR=obj/$(TARGET)$(DB)$(OSAL)$(PS)
endif

ifeq "$(CLEARCASE_PRIMARY_GROUP)" ""
  CLRCAS=0
else
  ifeq "$(IN_VOB)" "FALSE"
    CLRCAS=0
  else
    CLRCAS=1
  endif
endif

ifeq ($(CLRCAS), 1)
  CHECKOUT = -cleartool co -nc
  CHECKIN = -cleartool ci -nc
else
  CHECKOUT = attrib -r
  CHECKIN = attrib +r
endif

VPATH=$(OBJDIR);$(OSX_SRC)

# for created libraries
LIBDIR=../../LIB

# Lint
LINT=lint-nt.exe
LINT_INC=-i/gpf/template/lint/
LINT_OPT_FILE=/gpf/template/lint/options.lnt

#-------------------------Suffixes for the name of the output file
#---------e.g. osx_na7_db.lib

ifeq ($(TARGET), nuc)
  ifeq ($(PLATFORM), arm7)
    tTail :=_na7
  else
    ifeq ($(PLATFORM), arm9)
      tTail :=_na9
    else
      ifeq ($(PLATFORM), pc)
        tTail :=_npc
      endif
    endif
  endif
endif
ifeq ($(TARGET), linuxpc)
  tTail :=_lpc
  OSENV=sus
  NO_LINT=1
else
 ifeq ($(TARGET), rtlpc)
   tTail :=_rlp
   OSENV=sus
   NO_LINT=1
   RTL_VERSION=2.0
   RTL_DIR=/opt/rtldk-$(RTL_VERSION)/rtlinuxpro
   include $(RTL_DIR)/rtl.mk
 else
   ifeq ($(TARGET), linuxarm)
     tTail :=_la9
     OSENV=sus
     NO_LINT=1
   else
     ifeq ($(TARGET), solsparc)
       tTail :=_ssp
       OSENV=sus
       NO_LINT=1
     endif
   endif
 endif
endif

#---------- shell calls
RM      =       -rm -rf
ifeq ($(OSENV), sus)
  MKDIR   =       mkdir
else
  MKDIR   =       gmkdir
endif
COPY    =       cp
COPTS_FILE =
CLEARTOOL  = cleartool

ifeq ($(DEBUG), 1)
   dbTail :=_db
   DB=/db
else 
   dbTail:=
endif

ifeq ($(OS_ONLY), 1)
   osTail :=_os
   OSAL=/os
else 
   osTail:=
endif

ifeq ($(NO_OPT), 1)
  DISABLE_OPT:=1
  OPT:=/no
   noTail:=_no
else
  DISABLE_OPT:=0
  OPT:=
  noTail:=
endif

ifeq ($(MEMSUPER), 2)
   msTail :=_ps
   PS=/ps
endif
ifeq ($(MEMSUPER), 1)
   msTail :=_pm
endif
ifeq ($(MEMSUPER), 0) 
   msTail:=
   PS=
endif

XXX:=$(tTail)$(osTail)$(dbTail)$(msTail)$(noTail)$(tsTail)

#---------- Special settings for each target: for Nucleus/arm7
ifeq ($(TARGET), nuc)
  ifeq ($(PLATFORM), arm7)

   LINT_OPTS = $(LINT_INC) -I"$(subst \,/,$(C_DIR))" -u $(LINT_OPT_FILE)

   ifeq ($(MEMSUPER), 2)
      DEFINES =  -dMEMORY_SUPERVISION -dOPTIMIZE_POOL
   endif
   ifeq ($(MEMSUPER), 1)
      DEFINES = -dMEMORY_SUPERVISION
   endif

   ifeq ($(TOOL_CHOICE), )
    COPTS+= -mw -x -pw2 -q -o
   endif

   CC=cl470
   COPTS+= -me -mt

   ifeq ($(DEBUG), 1)
     ifeq ($(TOOL_CHOICE), )
        COPTS += -g
     else
        COPTS += -gt
     endif
     COPTS += -mn   
   endif

  ifeq ($(OS_ONLY), 1)
    DEFINES += -d_OSX_ON_OS_
  else
    COPTS+= -o3
  endif

   COPTS += -fr $(OBJDIR) -c 

   INCLUDES += -I"." -I"..\..\INC" -I"..\..\INC\NUC" 

   DEFINES += -d_TARGET_ -d_NUCLEUS_
   COPTSNF = $(COPTS) $(DEFINES) $(INCLUDES)
   COMMLFLAGS = -rq $@      # only one command is allowed and it is "r" for replace
   LFLAGS=$(COMMLFLAGS)
   LIB = ar470  $(LFLAGS)
   LIBEXT=lib
   OSX_LIB=$(LIBDIR)/osx$(XXX).$(LIBEXT)
   OBJTAIL=obj

   clean:
	@$(RM) obj/$(TARGET)/$(PLATFORM)$(DB)$(OSAL)$(PS)$(TS)/*.obj
	@$(RM) $(OSX_LIB)


endif         # platform: arm7
endif         # target: nucleus


#---------- Special settings for each target: for Nucleus/arm9
ifeq ($(TARGET), nuc)
  ifeq ($(PLATFORM), arm9)

   INCLUDES = -I"." -I"..\..\INC" -I"..\..\INC\NUC" 

   CC=cl470

    COPTS+= -me -mt

    ifneq ($(DISABLE_OPT), 1)
      ifeq ($(TOOL_CHOICE), 6)
        COPTS+= -O=2
      else
        COPTS+= -o
      endif
    endif

   ifeq ($(DEBUG), 1)
     ifeq ($(TOOL_CHOICE), 6)
       COPTS += --symdebug:coff
     else
       COPTS += -gt
       # toolsets 3 und 5
     endif
     COPTS += -mn   
   endif

   LINT_OPTS = $(LINT_INC) -I"$(subst \,/,$(C_DIR))" -u $(LINT_OPT_FILE)

   ifeq ($(MEMSUPER), 2)
      DEFINES =  -dMEMORY_SUPERVISION -dOPTIMIZE_POOL
   endif
   ifeq ($(MEMSUPER), 1)
      DEFINES = -dMEMORY_SUPERVISION
   endif

   ifeq ($(OS_ONLY), 1)
      DEFINES += -d_OSX_ON_OS_
   endif	  

   COPTS += -fr $(OBJDIR) -c 

   DEFINES += -d_TARGET_ -d_NUCLEUS_
   COPTSNF = $(COPTS) $(DEFINES) $(INCLUDES)
   COMMLFLAGS = -rq $@      # only one command is allowed and it is "r" for replace
   LFLAGS=$(COMMLFLAGS)
   LIB=ar470  $(LFLAGS)
   LIBEXT=lib
   OSX_LIB=$(LIBDIR)/osx$(XXX).$(LIBEXT)
   OBJTAIL=obj

   clean:
	@$(RM) obj/$(TARGET)/$(PLATFORM)$(DB)$(OSAL)$(PS)$(RV)$(OPT)$(TS)/*.obj
	@$(RM) $(OSX_LIB)


endif         # platform: arm9
endif         # target: nucleus

#----------NucleusWin
ifeq ($(TARGET), nuc)
  ifeq ($(PLATFORM), pc)

    CC=cl
    COPTS = /c /nologo /W3 /GX /Zp1 /GZ
    INCLUDES = -I"." -I"..\..\inc" -I"..\..\inc\nuc"
    LINT_OPT_FILE += co-msc50.lnt
    LINT_OPTS = $(LINT_INC) -D_WIN32 -D_M_IX86 -I"NUC" -u $(LINT_OPT_FILE)

    ifeq ($(DEBUG), 1)
      COPTS += /MD /DEBUG /Z7
      DEFINES += -D"_DEBUG" -D"NU_DEBUG"
    else
      COPTS += /MT
    endif

    COPTS += /FR"..\..\temp\nucwin"  /Fd"..\..\temp\nucwin" /Fo./$(OBJDIR)/

    ifeq ($(OS_ONLY), 1)
	  DEFINES += -D"_OSX_ON_OS_"
    endif

    ifeq ($(MEMSUPER), 2)
      DEFINES +=  -D"MEMORY_SUPERVISION"  -D"OPTIMIZE_POOL"
    endif
    ifeq ($(MEMSUPER), 1)
      DEFINES += -D"MEMORY_SUPERVISION"
    endif

    DEFINES += -D"_NUCLEUS_" 
    COPTSNF = $(COPTS) $(DEFINES) $(INCLUDES)
    COPTS_FILE =
    INCLUDELIST=$(subst /I ,-I,$(INCLUDES))
    DEFINELIST=$(subst /D ,-D,$(DEFINES))

    COMMLFLAGS =  /nologo  /subsystem:console  /machine:I386
    LFLAGS=$(COMMLFLAGS) #/debug??
    LIB=LIB /out:$@ $(LFLAGS)
    LIBEXT=lib
    OBJTAIL=obj
    OSX_LIB=$(LIBDIR)/osx$(XXX).$(LIBEXT)

    clean:
	@$(RM) obj/$(TARGET)/$(PLATFORM)$(DB)$(OSAL)$(PS)$(RV)/*.obj
	@$(RM) $(OSX_LIB)

  endif
endif         # nucleus && pc

ifeq ($(OSENV), sus)

    #_OS_LAYER += os_ctb.o
    OS_LAYER_SRC:=./$(OSENV)/
    COPTS = -c -o$(OBJDIR)/$@
    INCLUDES = -I. -I../../inc/$(OSENV) -I../../inc
    ifeq ($(TARGET), linuxtool)
      DEFINES += -D_TOOLS_
    endif

    DEFINES += -DPURE_USER_MODE #-DGSP_OSL_LOG
    ifeq ($(OS_ONLY), 1)
      DEFINES += -D_OSX_ON_OS_
    endif

    ifeq ($(DEBUG), 1)
      COPTS += -g
      DEFINES += -DOSL_DEBUG
    endif

    ifeq ($(MEMSUPER), 2)
      DEFINES +=  -DMEMORY_SUPERVISION  -DOPTIMIZE_POOL
    endif
    ifeq ($(MEMSUPER), 1)
      DEFINES += -DMEMORY_SUPERVISION
    endif

   ifeq ($(TARGET), rtlpc)
     COPTSNF = $(CFLAGS)
     MKLIB= i386-linux-ar ruv $@
     RANLIB= i386-linux-ranlib
     DEFINES += -D_RT_LINUX_
   else
     ifeq ($(TARGET), linuxarm)
       CC=arm-linux-gcc
       MKLIB= arm-linux-ar ruv $@
       RANLIB= arm-linux-ranlib
       DEFINES += -D_TARGET -D_LINUX_ -DGSP_OSL_LOG
     else
       ifeq ($(TARGET), solsparc)
         CC=gcc
         MKLIB= ar ruv $@
         RANLIB= ranlib
         DEFINES += -D_SOLARIS_ -D_LINUX_
       else
         CC=gcc
         MKLIB= ar ruv $@
         RANLIB= ranlib
         DEFINES += -D_LINUX_
       endif
     endif
   endif
    COPTSNF += $(COPTS) $(DEFINES) $(INCLUDES)
    COPTS_FILE =
    INCLUDELIST=$(subst /I ,-I,$(INCLUDES))
    DEFINELIST=$(subst /D ,-D,$(DEFINES))

    LIB=ar ruv $@
    LIBEXT=a
    OBJTAIL=o
    OSX_LIB=$(LIBDIR)/libosx$(XXX).$(LIBEXT)

    clean:
		@$(RM) obj/$(TARGET)/$(PLATFORM)$(DB)$(PS)/*.$(OBJTAIL)
		@$(RM) $(FRAME_LIB)

endif # osenv = sus
#########################  osx.lib    ##################################
OSX_INC = ../../inc/typedefs.h ../../inc/vsi.h ../../inc/header.h cust_os.h

OSX_SRC=./

_OSX_OBJS = osx.$(OBJTAIL)
OSX_OBJS=$(patsubst %.$(OBJTAIL),$(OBJDIR)/%.$(OBJTAIL),$(_OSX_OBJS))


foo:
	echo $(OSX_OBJS)
	echo $(_OSX_OBJS)
	echo $(OBJDIR)
	echo $(OBJTAIL)

osx.$(LIBEXT): $(COPTS_FILE) $(OSX_LIB)

$(OBJDIR) :
	$(MKDIR) -p $(OBJDIR)

$(OSX_LIB) : $(OBJDIR) $(COPTS_FILE) $(_OSX_OBJS)  makefile
# OWN_MAKELEVEL == 0 if makefile called directly, == 1 if nested
  ifneq ($(OWN_MAKELEVEL), 0)
	@echo checking out and touching using $(MAKE) 
		$(CHECKOUT) $@
		touch -c $@
   else
		gnumake MAKE=gnumake OWN_MAKELEVEL=1 $(subst \,/,$@ $<)
		@echo proceeding using $(MAKE) 
		$(LIB)  $(OSX_OBJS) 
    ifeq ($(OSENV), sus)
			$(RANLIB) $@
    endif
  endif


$(_OSX_OBJS) : %.$(OBJTAIL) : $(OSX_SRC)/%.c  $(OSX_INC)
#	$(LINT) $(LINT_OPTS) $(DEFINES) $(INCLUDES) $<
	$(CC) $(COPTSNF) $<