How to add library to makefile for verix

I want to use a makefile to create my application and .out file and use it in my verifone vx520. I have makeapp.bat to generate a .out file, but when I run it, I get the following error NMAKE : fatal error U1073: don't know how to make 'utils.h'

and this is the makeapp.bat file:

@goto Begin 
:Begin
@set OLDPATH=%PATH%
@rem set VRXSDKS to the Verix V SDK directory 
@set VRXSDK=C:\eVoAps\SDK\1.2.0\VRXSDK
@rem Set RVCTDIR to RVDS2.2
@set RVCTDIR=C:\Program Files\ARM\RVCT\Programs\2.2\349\win_32-pentium
@rem or, Set RVCTDIR to RVDS2.1
@rem set RVCTDIR=C:\Program Files\ARM\RVCT\Programs\2.0.1\277\win_32-pentium
@set PATH=%VRXSDK%\bin\;%RVCTDIR%;%OLDPATH%
@rem use app.mak to buid application
nmake /f app.mak 
@rem or, use vrxcc directly here to build a simple application
@rem %VRXSDK%\bin\vrxcc app.c
@set PATH=%OLDPATH%
@set RVCTDIR=

pause

      

how can i solve this error?

+1


source to share


1 answer


So it seems to me that your bat file has a lot of comments here (@rem) as well as a lot of variables (@set), but most of the work will be done in line

nmake /f app.mak 

      

which will refer to another file named app.mak

. This is where the magic happens and where you need to change something in order to nmake

compile and link skillfully utils.h

. I suggest you take a closer look at c2.com/cgi/wiki?UsingNmake .

As you know, a makefile is, for all intents and purposes, a program that you write. When it starts up, it creates the VeriFone app (or whatever program you've been working on). Thus, there are many things you can do, some of which you must do if you want nmake to actually build your program. I think the best way to help is by swapping parts of my make file. Note that this started out simply as a template from the VeriFone sample project.

Mine starts just declaring variables, paths, etc., like this:

ProjectName = TestProject

# ****** PATHS ******

# Includes
SDKIncludes = -I$(EVOSDK)\include
ACTIncludes = -I$(EVOACT)include
VCSIncludes = -I$(EVOVCS)include

#Libraries
ACTLibraries    = $(EVOACT)OutPut\RV\Files\Static\Release    

#  App Paths
AppIncludes = .\include
SrcDir      = .\source
ObjDir      = .\obj
OutDir      = .\Output\$(TerminalType)\$(VMACMode)\Files
ResDir      = .\Resource

      

Note that TerminalType

- this is what I set Visual Studio to pass to NMAKE when it initiates a build and is based on my solution configuration. Technically, I have one file, which causes the other, and the outer sets it as follows: TerminalType=$(Configuration)

. You will see this variable again below, as well as a couple of others that are similar.

Next, I define some compiler options

#  Switch based on terminal type
!IF "$(TerminalType)"=="eVo"
CompilerCompatibility=-p
DefineTerminalType = -DEVO_TERMINAL
!ELSE
CompilerCompatibility=
DefineTerminalType = -DVX_TERMINAL
!ENDIF

      

The flag -D

defines things in my code as if I did #define

. This is useful for enabling or disabling details depending on what I'm going for. If you don't plan to do this, you won't need to do it yourself. The important part here for compiling for eVo terminals is CompilerCompatibility

which sets the flag -p

(must be off for Verix V, must be on for eVo terminals).

We will now consolidate everything we have done so far into 2 variables:

Includes    = -I$(AppIncludes) $(SDKIncludes) $(ACTIncludes) $(VMACIncludes) $(VCSIncludes)
COptions    =$(CompilerCompatibility) $(DefineTerminalType) 

      

OK, now here's the part I suspect you are stumbling over: we need to define our dependencies, which I love so much:

# Dependencies
AppObjects = \
        $(ObjDir)\$(ProjectName).o \
        $(ObjDir)\Base.o \
        $(ObjDir)\UI.o \
        $(ObjDir)\Comm.o

Libs =      $(ACTLibraries)\act2000.a

      



It can all go along the same line if we want it. \

at the end of each line just means that we are breaking that single line, which is done here for readability. Otherwise it will look like this:

AppObjects = $(ObjDir)\$(ProjectName).o $(ObjDir)\Base.o $(ObjDir)\UI.o $(ObjDir)\Comm.o

Libs = $(ACTLibraries)\act2000.a

      

OK, so this one AppObjects

will be used when we communicate. First, however, I also want to say that NMAKE launches the file signing program and then copies the files to where I want them.

#  Sign the file(s).  Tell nMake that we also
#  will be creating the resource file and compiling the actual code...
#  NOTE: (the indentations seen below are required for nMake to work properly)
#  pseudoOut depends on TestProject.res and TestProject.out.  
#  If TestProject.res or TestProject.out have changed more recently than pseudoOut, 
#  then run commands vrxhdr..., filesignature..., and move...
!if "$(VMACMode)"=="Multi"
pseudoOut : $(ResDir)\$(ProjectName).res $(OutDir)\$(ProjectName).out
!else
pseudoOut : $(OutDir)\$(ProjectName).out 
!endif
#   This calls vrxhdr: the utility program that fixes the executable program’s header required to load and run the program.
# Vrxhdr is needed when you want to move a shared library around on the terminal.
    $(EVOSDK)\bin\vrxhdr -s 15000 -h 5000 $(OutDir)\$(ProjectName).out

# do the signing using the file signature tool and the .fst file associated with this TerminalType.
    "$(VSFSTOOL)\filesignature" $(TerminalType)$(VMACMode).fst -nogui
    @echo __________________ move files to out directory __________________
# rename the .p7s file we just created 
    move $(OutDir)\$(ProjectName).out.p7s $(OutDir)\$(ProjectName).p7s

!if "$(VMACMode)"=="Multi"
    copy $(ResDir)\imm.ini $(OutDir)\imm.ini
    copy $(ResDir)\$(ProjectName).INS $(OutDir)\$(ProjectName).INS
    copy $(ResDir)\$(ProjectName).res $(OutDir)\$(ProjectName).res
!endif
    @echo *****************************************************************

      

Now let's define how we will link:

#  Link object files
$(OutDir)\$(ProjectName).out : $(AppObjects)
    $(EVOSDK)\bin\vrxcc $(COptions) $(AppObjects) $(Libs) -o $(OutDir)\$(ProjectName).out

      

... and create a .res file ...

#This will actually build the .res file. (We only said we were going to do it above)
!if "$(VMACMode)"=="Multi"
#  compile resource file
$(ResDir)\$(ProjectName).res : $(ResDir)\$(ProjectName).rck
#   SET INCLUDE=$(INCLUDE);$(EVOVMAC)\include;$(EVOVMAC)\template --> I put this into my include path for the project, instead
    $(EVOTOOLS)rck2 -S$(ResDir)\$(ProjectName) -O$(ResDir)\$(ProjectName) -M
!endif

      

and now we can start compiling:

#  Compile modules --> -c = compile only, -o = output file name, -e"-" => -e redirect error output from sub-tools to... "-" to stdout. (These are all then redirected via pipe | )
# For more details, see Verix_eVo_volume 3, page 59

$(ObjDir)\$(ProjectName).o : $(SrcDir)\$(ProjectName).c
!IF !EXISTS($(OutDir))
    !mkdir $(OutDir)
!ENDIF
    -$(EVOSDK)\bin\vrxcc -c $(COptions) $(Includes) -o $(ObjDir)\$(ProjectName).o $(SrcDir)\$(ProjectName).c -e"-" | "$(EVOTOOLS)fmterrorARM.exe"

$(ObjDir)\Base.o : $(SrcDir)\Base.c 
  $(EVOSDK)\bin\vrxcc -c $(COptions) $(Includes) -o $(ObjDir)\base.o $(SrcDir)\Base.c -e"-" | "$(EVOTOOLS)fmterrorARM.exe"

$(ObjDir)\UI.o : $(SrcDir)\UI.c 
  $(EVOSDK)\bin\vrxcc -c $(COptions) $(Includes) -o $(ObjDir)\UI.o $(SrcDir)\UI.c -e"-" | "$(EVOTOOLS)fmterrorARM.exe"

$(ObjDir)\Comm.o : $(SrcDir)\Comm.c 
  $(EVOSDK)\bin\vrxcc -c $(COptions) $(Includes) -o $(ObjDir)\Comm.o $(SrcDir)\Comm.c -e"-" | "$(EVOTOOLS)fmterrorARM.exe"

      

And that last line - there is no other fanfare or whatever you have.

I would like to point out something that you may have noticed, but threw me for a loop when I started this all: we kind of "do everything backwards". If I were telling a person how to build a project, I would start by telling them how to first compile it to a file .o

, but this is the last step in the make file. Then I'll tell the person how to make a link, but from the second to the last step, etc.

If you still need more information, check out the link I've included - it's more authoritative than me and includes a lot of details that I probably missed. Hope this is enough to get you going.

+3


source







All Articles