FreeCalypso > hg > leo2moko-debug
diff gpf/MISC/makefile @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpf/MISC/makefile Mon Jun 01 03:24:05 2015 +0000 @@ -0,0 +1,660 @@ +####################### Makefile for GNU make ##################### +# +# makefile to build misc.lib +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# targets: +# +# misc.lib functions which belong neither to frame nor to tif, somehow old files +# clean delete temp files +# +####################################################################### + +OWN_MAKELEVEL=0 + + +VPATH=$(OBJDIR) + +#---------- Directories + +ifeq ($(TARGET), nuc) + ifeq ($(RUN_FLASH), 1) + SECTION:=/fl + endif + + ifeq ($(RUN_INT_RAM), 1) + SECTION:=/ir + endif +else + SECTION:= +endif + +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 + C_DIR=PATH_CC_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 +# C_DIR=PATH_CC_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 + COPTS+= -O=2 + ifndef PATH_CC_4_11 + PATH_CC_4_11=C:\Dvpt_tools\Codegen\TMS4701x_4.11 +# C_DIR=PATH_CC_4_11 + endif + Path:=$(PATH_CC_4_11)/bin;$(Path) + INCLUDES += -I"$(PATH_CC_4_11)/include" +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 + +# for created object files +# general directories +GPFDIR=.. +INCDIR=../inc +ifeq ($(TARGET), nuc) + OBJDIR=obj/$(TARGET)/$(PLATFORM)$(DB)$(PS)$(SECTION)$(TS) +else + OBJDIR=obj/$(TARGET)$(DB)$(PS) +endif + +# for stack calculation +GAWK=../tools/bin/gawk.exe +AWK_PROG=../BIN/cg$(tTail).awk + +# Lint +LINT=lint-nt.exe +LINT_INC=-i/gpf/template/lint/ +LINT_OPT_FILE=/gpf/template/lint/options.lnt + +# for created libraries +ifeq ($(TARGET), win32) + LIBDIR=../LIB/WIN32$(DEBUGDIR) + BINDIR=../BIN$(DEBUGDIR) +else + LIBDIR=../LIB +endif + +#-------------------------globaly exported header files +INC_FILES=Tools.h + +#-------------------------Suffixes for the name of the output file +#---------e.g. misc_tr_db.lib + +ifeq ($(RUN_FLASH), 1) + flTail :=_fl +else + flTail:= +endif + +ifeq ($(RUN_INT_RAM), 1) + irTail :=_ir +else + irTail:= +endif + +ifeq ($(TARGET), nuc) + ifeq ($(PLATFORM), arm7) + tTail :=_na7 + else + ifeq ($(PLATFORM), arm9) + tTail :=_na9 + else + ifeq ($(PLATFORM), pc) + tTail :=_npc + endif + endif + endif +else + ifeq ($(TARGET), nuc_ARM) + tTail :=_ar + else + ifeq ($(TARGET), win32) + tTail := + else + ifeq ($(TARGET), psos) + tTail :=_po + else + ifeq ($(TARGET), vxworks) + tTail :=_vx + ifeq ($(TOOL), gnu) + tlTail :=_gn + else + tlTail :=_di + endif + ifeq ($(CPU), PPC603) + cpTail :=_pp + endif + else + 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 + endif + endif + endif + endif +endif + +ifeq ($(DEBUG), 1) + DB=/db + ifeq ($(TARGET), win32) + DEBUGDIR=/debug + dbTail := + else + dbTail :=_db + endif +else + dbTail:= + DB= +endif + +XXX:=$(tTail)$(tlTail)$(cpTail)$(dbTail)$(irTail)$(flTail)$(tsTail) + +_MISC_OBJS=printtofile.$(OBJTAIL) tok.$(OBJTAIL) tools.$(OBJTAIL) misc_version.$(OBJTAIL) + +ifeq ($(OSENV), sus) + MKDIR = mkdir +else + MKDIR = gmkdir +endif +COPY = cp +CLEARTOOL = cleartool +ECHO = @echo + +#---------- Special settings for each target: for Nucleus +ifeq ($(TARGET), nuc) + ifeq ($(PLATFORM), arm7) + + 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 ($(ASM_ONLY), 1) + COPTS+= -q -n -x0 -fs $(OBJDIR) + MKLIB = $(GAWK) -f $(AWK_PROG) > $(MISC_LIB) + OBJTAIL = asm + MISC_LIB = $(OBJDIR)/misc$(XXX).pa + else + OBJTAIL = obj + MKLIB=ar470 $(LFLAGS) + MISC_LIB=$(LIBDIR)/misc$(XXX).$(LIBEXT) + LINT_OPTS = $(LINT_INC) -I"$(subst \,/,$(C_DIR))" -u $(LINT_OPT_FILE) + + endif + + COPTS += -fr $(OBJDIR) -c + + ifeq ($(RUN_INT_RAM), 1) + COPTS += -dRUN_INT_RAM + endif + + ifeq ($(RUN_FLASH), 1) + COPTS += -dRUN_FLASH + endif + + INCLUDES+= -I"." -I"..\inc\NUC" -I"..\inc\NUC\ARM7" -I"..\inc" + + DEFINES += -d_TARGET_ -d_NUCLEUS_ + COPTSNF = $(COPTS) $(DEFINES) $(INCLUDES) + INCLUDELIST=$(subst /I ,-I,$(INCLUDES)) # because of CDGINCDIR above + DEFINELIST=$(subst -d,-D,$(DEFINES)) + COMMLFLAGS = -rq $@ # only one command is allowed and it is "r" for replace + LFLAGS=$(COMMLFLAGS) + LIBEXT=lib + + clean: + @$(RM) obj/$(TARGET)/$(PLATFORM)$(DB)$(SECTION)$(TS)/*.$(OBJTAIL) + @$(RM) $(MISC_LIB) + + endif +endif # nucleus & arm7 + +ifeq ($(TARGET), nuc) + ifeq ($(PLATFORM), arm9) + + CC=cl470 + + COPTS+= -me -mt + + ifeq ($(DEBUG), 1) + ifeq ($(TOOL_CHOICE), 6) + COPTS += --symdebug:coff + else + # toolset 3 and 5 + COPTS += -gt + endif + COPTS += -mn + endif + + LINT_OPTS = $(LINT_INC) -I"$(subst \,/,$(C_DIR))" -u $(LINT_OPT_FILE) + + COPTS += -fr $(OBJDIR) -c + + ifeq ($(RUN_INT_RAM), 1) + COPTS += -dRUN_INT_RAM + endif + + ifeq ($(RUN_FLASH), 1) + COPTS += -dRUN_FLASH + endif + + INCLUDES+= -I"." -I"..\INC\NUC" -I"..\INC\NUC\ARM9" -I"..\INC" + MKLIB=ar470 $(LFLAGS) + + DEFINES += -d_TARGET_ -d_NUCLEUS_ + COPTSNF = $(COPTS) $(DEFINES) $(INCLUDES) + INCLUDELIST=$(subst /I ,-I,$(INCLUDES)) # because of CDGINCDIR above + DEFINELIST=$(subst -d,-D,$(DEFINES)) + COMMLFLAGS = -rq $@ # only one command is allowed and it is "r" for replace + LFLAGS=$(COMMLFLAGS) + LIBEXT=lib + OBJTAIL=obj + MISC_LIB=$(LIBDIR)/misc$(XXX).$(LIBEXT) + + clean: + @$(RM) obj/$(TARGET)/$(PLATFORM)$(DB)$(SECTION)$(TS)/*.$(OBJTAIL) + @$(RM) $(MISC_LIB) + + endif +endif # nucleus & arm9 + + +#---------- Special settings for each target: for Nucleus_ARM +ifeq ($(TARGET), nuc_ARM) + + CC=perl "\G23M\Condat\INT\BIN\gti_compile.pl" + COPTS= -me -mt -pw2 -q -x -mw -o # from condat_env.mak and os.mak for nucleus.lib + + ifeq ($(DEBUG), 1) + COPTS += -g -mn + endif + COPTS += -fr $(OBJDIR) -fo $(OBJDIR)/$@ -c + + +#new INCLUDES+= -I"..\inc\NUC" -I"..\inc\NUC\ARM7" -I"..\inc" + INCLUDES+= -I"..\inc\NUC" -I"..\inc" + DEFINES += -d_TARGET_ -d_NUCLEUS_ + COPTSNF = $(COPTS) $(DEFINES) $(INCLUDES) + INCLUDELIST=$(subst /I ,-I,$(INCLUDES)) # because of CDGINCDIR above + DEFINELIST=$(subst -d,-D,$(DEFINES)) + + COMMLFLAGS = -rq $@ # only one command is allowed and it is "r" for replace + LFLAGS=$(COMMLFLAGS) + MKLIB=perl "\G23M\Condat\INT\BIN\gti_archive.pl" $(LFLAGS) + LIBEXT=lib + OBJTAIL=obj + MISC_LIB=$(LIBDIR)/misc$(XXX).$(LIBEXT) + + clean: + @$(RM) obj/$(TARGET)$(DB)/*.$(OBJTAIL) + @$(RM) $(MISC_LIB) + +endif # target: nucleus_ARM + + +#---------- Special settings for each target: for NucWin +ifeq ($(TARGET), nuc) + ifeq ($(PLATFORM), pc) + + CC=cl + COPTS += /c /nologo /W3 /GX /Zp1 /GZ + + ifeq ($(DEBUG), 1) + COPTS += /MD /DEBUG /Z7 + DEFINES += -D"_DEBUG" + else + COPTS += /MT + endif + + COPTS += /FR"..\temp\nucwin" /Fd"..\temp\nucwin" /Fo./$(OBJDIR)/ + + INCLUDES += -I"..\inc\NUC" -I"..\inc\NUC\PC" -I"..\inc" \ + -I"$(GSMDIR)\CDGINC\cdginc_fd" + + DEFINES += -D"_NUCLEUS_" + COPTSNF = $(COPTS) $(DEFINES) $(INCLUDES) + LINT_OPT_FILE += co-msc50.lnt + LINT_OPTS = $(LINT_INC) -D_M_IX86 -I"NUC" -u $(LINT_OPT_FILE) + INCLUDELIST=$(subst /I ,-I,$(INCLUDES)) + DEFINELIST=$(subst /D ,-D,$(DEFINES)) + COMMLFLAGS = /nologo /subsystem:console /machine:I386 + + LFLAGS=$(COMMLFLAGS) + MKLIB=LIB /out:$@ $(LFLAGS) + LIBEXT=lib + OBJTAIL=obj + MISC_LIB=$(LIBDIR)/misc$(XXX).$(LIBEXT) + + clean: + @$(RM) obj/$(TARGET)/$(PLATFORM)$(DB)/*.$(OBJTAIL) + @$(RM) $(MISC_LIB) + + endif +endif # nucleus & pc + + + +#---------- Special settings for each target: for Win32 +ifeq ($(TARGET), win32) + + FRAMEXXX:=$(tTail)$(trTail)$(rtTail)$(dbTail)$(msTail) + CC=cl + COPTS += /c /nologo /W3 /GX /Zp1 /GZ + + COPTS += /FR"..\temp\win32" /Fd"..\temp\win32" /Fo./$(OBJDIR)/ + + INCLUDES += -I"..\inc\WIN32" -I"..\inc" + + INCLUDES += -I"..\lib\win32" + + LINT_OPT_FILE += co-msc50.lnt + LINT_OPTS = $(LINT_INC) -D_WIN32 -D_M_IX86 -D_MSC_VER -I"WIN32" -u $(LINT_OPT_FILE) + + DLLFLAGS= /dll /implib:"$(LIBDIR)/misc$(XXX).lib" /def:"misc.def" + + COMMLFLAGS = $(DLLFLAGS) + COMMLFLAGS += /nologo + + ifeq ($(DEBUG), 1) + DEFINES += -D"_DEBUG" + COPTS += /DEBUG /MDd /Zi + COMMLFLAGS += /DEBUG /incremental:no /pdb:none + else + COPTS += /MD + endif + + DEFINES += -D"_TOOLS_" + COPTSNF = $(COPTS) $(DEFINES) $(INCLUDES) + INCLUDELIST=$(subst /I ,-I,$(INCLUDES)) + DEFINELIST=$(subst /D ,-D,$(DEFINES)) + + LFLAGS=$(COMMLFLAGS) + MKLIB=link.exe /out:$@ $(LFLAGS) + LIBEXT = dll + OBJTAIL=obj + IMPLIB=$(LIBDIR)/misc$(XXX).lib + MISC_LIB=$(BINDIR)/misc$(XXX).$(LIBEXT) + + + clean: + $(RM) $(OBJDIR)/*.$(OBJTAIL) + $(RM) $(IMPLIB) $(MISC_LIB) + + +endif # target: win32 + + + +#---------- Special settings for each target: for pSOS+ +ifeq ($(TARGET), psos) + + CC=cc386 + COPTS_FILE:=c.opt + + -include $(PSS_BSP)/bsp.mk# board support settings e.g. MODEL, FPU + + ifeq ( FPU,H ) + FPUOPT = -VNDP + else + FPUOPT= + endif + + COPTS1 = -c -V$(MODEL) -VROM -VBSS -VANSI -VLONGNAME -VSPROTO -VQUIET -VDIAGNOSTICS + COPTS2 = $(FPUOPT) + COPTS3 = -I. -I$(PSS_ROOT)/include -I$(PSS_BSP) + COPTS4 = -I./ -I../inc/ -I../inc/psos/ + COPTS5 = -DMODEL=$(MODEL) -VNOSIGNEDCHAR -D__CADUL__=1 -DPSOS=1 -D_PSOS_ + + ifeq ($(DEBUG), 1) + COPTS5 += -VXDB + endif + + + COPTS = @c.opt + COPTS += -o $(OBJDIR)/$@ + COPTSNF = $(COPTS) + LIBEXT = lib + OBJTAIL=obj + MKLIB= lib386 $@ # psos related libs will not be included here + MISC_LIB=$(LIBDIR)/misc$(XXX).$(LIBEXT) + +c.opt: makefile + @echo $(COPTS1) > c.opt + @echo $(COPTS2) >> c.opt + @echo $(COPTS3) >> c.opt + @echo $(COPTS4) >> c.opt + @echo $(COPTS5) >> c.opt + + clean: + @$(RM) obj/$(TARGET)$(DB)/*.$(OBJTAIL) + @$(RM) $(MISC_LIB) + @$(RM) *.opt + +endif # target: psos + +#---------- Special settings for each target: for VxWorks GNU +ifeq ($(TARGET), vxworks) + + CC = ccppc + + ifeq ($(DEBUG), 1) + COPTSNF = -g + else + COPTSNF = -O2 + endif + COPTSNF += -c -mstrict-align -ansi -nostdinc -DRW_MULTI_THREAD -D_REENTRANT \ + -fvolatile -fno-builtin -fno-for-scope -DCPU=$(CPU) \ + -I$(WIND_BASE)/target/h -I. -I../inc -I../inc/$(TARGET) \ + -D_VXWORKS_ + + COPTSNF += -o $(OBJDIR)/$@ + LIBEXT = a + OBJTAIL=obj + MISC_LIB = $(LIBDIR)/misc$(XXX).$(LIBEXT) + MKLIB = arppc crus $(MISC_LIB) + + clean: + @$(RM) obj/$(TARGET)$(DB)/*.$(OBJTAIL) + @$(RM) $(MISC_LIB) + +endif +# target: vxworks + +#---------- Special settings sus environment +ifeq ($(OSENV), sus) + COPTS += -c -o$(OBJDIR)/$@ + INCLUDES += -I../inc/$(OSENV) -I../inc -I../FRAME -I../FRAME/$(OSENV) -I. + INCLUDES += -I../CCD + ifeq ($(MEMSUPER), 2) + DEFINES += -DMEMORY_SUPERVISION -DOPTIMIZE_POOL + endif + ifeq ($(MEMSUPER), 1) + DEFINES += -DMEMORY_SUPERVISION + endif + # the following should be adapted for other unix-like systems + + DEFINES += -DSHARED_VSI -DNEW_FRAME + OBJTAIL = o + LIBEXT= a + ifeq ($(TARGET), rtlpc) + DEFINES += -D_LINUX_ + COPTSNF = $(CFLAGS) + MKLIB= i386-linux-ar ruv $@ + RANLIB= i386-linux-ranlib + DEFINES += -D_RT_LINUX_ + else + ifeq ($(TARGET), linuxarm) + DEFINES += -D_LINUX_ + CC=arm-linux-gcc + MKLIB= arm-linux-ar ruv $@ + RANLIB= arm-linux-ranlib + DEFINES += -DGSP_TARGET + else + ifeq ($(TARGET), solsparc) + DEFINES += -D_SOLARIS_ + CC=gcc + MKLIB= ar ruv $@ + RANLIB= ranlib + else + DEFINES += -D_LINUX_ + CC=gcc + MKLIB= ar ruv $@ + RANLIB= ranlib + endif + endif + endif + COPTSNF += $(COPTS) $(DEFINES) $(INCLUDES) + MISC_LIB = $(LIBDIR)/libmisc$(XXX).$(LIBEXT) + MKLIB= ar ruv $@ + clean: + @$(RM) obj/$(TARGET)$(DB)/*.$(OBJTAIL) + @$(RM) $(MISC_LIB) +endif + +######################### misc.lib ################################## + +MISC_OBJS=$(patsubst %.$(OBJTAIL),$(OBJDIR)/%.$(OBJTAIL),$(_MISC_OBJS)) + +asm: $(MISC_LIB) $(OBJDIR) + +misc.$(LIBEXT): $(MISC_LIB) + +$(OBJDIR) : + $(MKDIR) -p $(OBJDIR) + +$(MISC_LIB) : $(OBJDIR) $(COPTS_FILE) $(_MISC_OBJS) makefile +# OWN_MAKELEVEL == 0 if makefile called directly, == 1 if nested +ifneq ($(OWN_MAKELEVEL), 0) + @echo checking out and touching using $(MAKE) + $(CHECKOUT) $@ $(IMPLIB) + touch -c $@ $(IMPLIB) +else + gnumake MAKE=gnumake OWN_MAKELEVEL=1 $(subst \,/,$@ $<) + @echo proceeding using $(MAKE) + $(MKLIB) $(MISC_OBJS) + ifeq ($(OSENV), sus) + $(RANLIB) $@ + endif +endif + +$(_MISC_OBJS): %.$(OBJTAIL): %.c + $(RM) $(OBJDIR)/misc_version.$(OBJTAIL) +ifneq ($(NO_LINT), 1) + $(LINT) $(LINT_OPTS) $(DEFINES) $(INCLUDES) $< +endif + $(CC) $(COPTSNF) $< + +SRCFILES=$(patsubst %.$(OBJTAIL),%.c,$(_MISC_OBJS)) +MISC_DEP=dep_misc_$(PROJECT)$(XXX).mk + +help: + $(ECHO) usage... + $(ECHO) building: + $(ECHO) "gnumake [DEBUG={1|0}] [ROUTING={1|0}] [MEMSUPER={1|0}] ..." + $(ECHO) cleaning: + $(ECHO) "gnumake clean [DEBUG={1|0}] [ROUTING={1|0}] [MEMSUPER={1|0}] ..." + $(ECHO) ClearCase: + $(ECHO) "gnumake checkin - not implemeted yet -" + $(ECHO) "gnumake label LABEL=<label type> [FLOAT={1|0}] [DEBUG={1|0}] [ROUTING={1|0}] " + $(ECHO) " [MEMSUPER={1|0}] ..." + $(ECHO) help: + $(ECHO) "gnumake help" + +DEPEND_DIRS=$(GPFDIR) $(LIBDIR) $(BINDIR) $(INCDIR) +EXPORT_FILES=$(IMPLIB) $(MISC_LIB) +INCLUDE_FILES=$(patsubst %,../inc/%,$(INC_FILES)) + +label: + -$(CLEARTOOL) mklabel -recurse $(REPLACE) $(LABEL) . 2>> error.log + -$(CLEARTOOL) mklabel $(REPLACE) $(LABEL) $(DEPEND_DIRS) \ + $(EXPORT_FILES) $(INCLUDE_FILES) 2>> error.log + +depend: $(SRCFILES) + @touch $(MISC_DEP) + makedepend -b -f$(MISC_DEP) $^ -Y -o.$(OBJTAIL) $(INCLUDELIST) $(DEFINELIST) + @$(RM) $(MISC_DEP).bak + +-include $(MISC_DEP)