Makefile for building the snacc compiler

sameer_mastek sameer_mastek at yahoo.co.in
Wed Jul 4 07:34:45 UTC 2007


Hi,

I am trying to write a makefile for building Snacc 1.7.

I am able to build the cppasn.dll and cppasn_static.dll, 

But in case of esnacc.exe I am not able to compile.

I have pasted the makefile, batch file and the output.

Please, help me out.


the make file is as follows,
#
#**********************************************************************************

!MESSAGE 
!MESSAGE 
!MESSAGE 
!MESSAGE              IF RUNNING ON WINDOWS PLATFORM BE SURE YOU HAVE RUN
VCVARS32.BAT. 
!MESSAGE 
!MESSAGE 
!MESSAGE 
!MESSAGE 

!IF "$(SOURCE_DIR)" == ""
!MESSAGE Source Directory is not specified. 
!ENDIF

!IF "$(OUTPUT_DIR)" == ""
!MESSAGE Output Directory is not specified. 
!ENDIF 

!IF "$(INT_DIR)" == ""
!MESSAGE Intermediate Directory is not specified. 
!ENDIF 
!IF "$(BUILD_TYPE)" == ""
!MESSAGE No build type specified. 
!MESSAGE You can specify a configuration when running NMAKE by defining the
macro BUILD_TYPE on the command line.
!MESSAGE For example:
!MESSAGE 
!MESSAGE NMAKE /f "compiler.makefile" BUILD_TYPE="Debug"
!MESSAGE OR
!MESSAGE NMAKE /f "compiler.makefile" BUILD_TYPE="Release"
!MESSAGE 
!ERROR No Build Type specified.
!ENDIF 

!IF  "$(BUILD_TYPE)" == "Release"
!MESSAGE
!MESSAGE **************            Release Build           
**********************
!MESSAGE
!MESSAGE

#  `````````````   Export Output and intermediate directories path
```````````````
OUT_PUT = $(OUTPUT_DIR)
INTDIR  = $(INT_DIR)
SRCDIR  = $(SOURCE_DIR)
CORE = $(SNACC_HOME)\compiler\core
BACK_ENDS = $(SNACC_HOME)\compiler\back-ends

#  ^^^^^^^^^^^^^         Set the Code Generation Model    
^^^^^^^^^^^^^^^^^^^^^^^
CC_MODEL = /MD /DTHREAD
#DEBUG =
LDFLAGS  =

INCR_BUILD=no
### Platform specific compiler definitions
CC = CL /nologo $(CC_MODEL)  /MDd /W3 /Gm- /GR /GX /ZI /Od /D "WIN32" \
    /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" \
    /D "_USRDLL" /D "_DEBUG_TRACE_" /D "_INFO_" \
    /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /FD /GZ /c

CC_EXE_TARGET  = /Fo

#  ~~~~~~~~~~~~    Mention the library files needed for release build 
~~~~~~~~~
REQ_LIBS = casn1_static.lib

!ELSEIF  "$(BUILD_TYPE)" == "Debug"
!MESSAGE 
!MESSAGE **************            Debug Build            
**********************
!MESSAGE 
!MESSAGE 

#  `````````````   Export Output and intermediate directories path
```````````````
OUT_PUT = $(OUTPUT_DIR)
INTDIR  = $(INT_DIR)
SRCDIR  = $(SOURCE_DIR)

#  ^^^^^^^^^^^^^         Set the Code Generation Model    
^^^^^^^^^^^^^^^^^^^^^^^
CC_MODEL = /MDd /DTHREAD
#DEBUG = 1
LDFLAGS  = 

INCR_BUILD=yes
### Platform specific compiler definitions

CC = CL /nologo $(CC_MODEL)  /MDd /W3 /Gm- /GR /GX /ZI /Od /D "WIN32" \
       /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" \
       /D "_USRDLL" /D "_DEBUG_TRACE_" /D "_INFO_" \
       /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /FD /GZ /c

CC_EXE_TARGET  = /Fo

#  ~~~~~~~~~~~~    Mention the library files needed for Debug build 
~~~~~~~~~
REQ_LIBS = casn1_static.lib
!ENDIF
#     **************                                       
**********************

LINK_EXE = LINK /nologo \
                /incremental:$(INCR_BUILD) \
                /subsystem:console \
                /pdb:none \
                /map:"$(INTDIR)/esnacc.map" \
                /machine:I386 \
                /out:"Release/esnacc.exe" \
                $(LIB_PATHS)

#Add the lib path on which this exe is dependent
LINK_DLL_TARGET = /OUT:
LINK_EXE   = LINK $(LDFLAGS)
LINK_EXE_TARGET = /OUT:

CCDEFS =

##############################LIB DIRECTORIES###############################
CPPASN1_LIB = $(SNACC_HOME)\c++-lib\cppasn1\Release
CASN1_STATIC_LIB = D:\SAMEER\SnaccDownload\SMPDist\lib

!IF "$(OS)" == "Windows_NT"
VCLIBDIR = $(MSVCDir)\VC98\Lib
MFCLIBDIR = $(MSVCDir)\VC98\MFC\Lib
!ENDIF
LIB_PATHS = /LIBPATH:$(VCLIBDIR) /LIBPATH:$(CPPASN1_LIB)
/LIBPATH:$(CASN1_STATIC_LIB) /LIBPATH:$(MFCLIBDIR)

##############################INCLUDES
DIRECTORIES###############################
!IF "$(OS)" == "Windows_NT"
CCINCLUDES = -I. \
             -I$(SNACC_HOME) \
             -I$(SNACC_HOME)\c-lib\inc \
             -I$(SNACC_HOME)\c++-lib\inc \
             -I$(SNACC_HOME)\compiler \
             -I$(SNACC_HOME)\compiler\core \
             -I$(SNACC_HOME)\compiler\back-ends \
             -I$(SNACC_HOME)\compiler\back-ends\c++-gen \
             -I$(MSVCDir)\VC98\Include

#Add the additional Include directories here after giving a "\" at the end
of above line
!ELSE
CCINCLUDES = -I. \
             -I$(SNACC_HOME) \
             -I$(SNACC_HOME)\c-lib\inc \
             -I$(SNACC_HOME)\compiler \
             -I$(SNACC_HOME)\compiler\core \
             -I$(SNACC_HOME)\compiler\back-ends \
             -I$(MSVCDir)\VC98\Include

#Add the additional Include directories here after giving a "\" at the end
of above line
!ENDIF

################################################################################


########################### Compiler flags
#####################################
CCFLAGS    = $(CCINCLUDES) $(CCDEFS) 
################################################################################


#####################Standard build rules for .cpp
files########################
################ Add all the CPP files to be compiled below
####################
.SUFFIXES: .CPP .C .obj .CXX .h .hh .hpp

.C.obj:
    $(CC) $(CCFLAGS) -c /Tp $<

.CPP.obj:
    $(CC) $(CCFLAGS) -c /Tp $<

.CXX.obj:
    $(CX) $(CXINCLUDES) -c /Tp $<

##Name of the Executable (DLL or EXE)
EXE = esnacc.exe

all: cleanexe $(EXE) clean

!CMDSWITCHES  +I
cleanexe:
  if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
    del $(OUT_PUT)\esnacc.exe
    cd $(SOURCE_DIR)
!CMDSWITCHES -I

!CMDSWITCHES  +I
clean:
    del $(INTDIR)\*.obj
    del $(INTDIR)\*.idb
    del $(INTDIR)\*.pdb
    del $(INTDIR)\*.ilk
  del $(INTDIR)\*.exp
!CMDSWITCHES -I

### All the corresponding .obj files of CPP and C files present in the
project directory only
esnacc.exe: ".\core\define.obj" \
              ".\core\dependency.obj" \
              ".\core\do-macros.obj" \
              ".\core\enc-rules.obj" \
              ".\core\err-chk.obj" \
              ".\core\exports.obj" \
              ".\core\gen-tbls.obj" \
              ".\core\gfsi.obj" \
              ".\core\lex-asn1.obj" \
              ".\core\lib-types.obj" \
              ".\core\link-types.obj" \
              ".\core\link-values.obj" \
              ".\core\mem.obj" \
              ".\core\meta.obj" \
              ".\core\normalize.obj" \
              ".\core\oid.obj" \
              ".\core\parse-asn1.obj" \
              ".\core\print.obj" \
              ".\core\recursive.obj" \
              ".\core\snacc-util.obj" \
              ".\core\snacc.obj" \
              ".\core\tbl.obj" \
              ".\core\val-parser.obj" \
              ".\core\gen-any.obj" \
              ".\core\gen-code.obj" \
              ".\core\gen-dec.obj" \
              ".\core\gen-enc.obj" \
              ".\core\gen-free.obj" \
              ".\core\gen-print.obj" \
              ".\core\gen-type.obj" \
              ".\core\gen-vals.obj" \
              ".\core\kwd.obj" \
              ".\core\rules.obj" \
              ".\core\type-info.obj" \
              ".\core\util.obj" \
              ".\core\cxxconstraints.obj" \
              ".\core\cxxmultipleconstraints.obj" \
              ".\Release\C++\gen-any.obj" \
              ".\Release\C++\gen-code.obj" \
              ".\Release\C++\gen-vals.obj" \
              ".\Release\C++\kwd.obj" \
              ".\Release\C++\rules.obj" \
              ".\Release\C++\types.obj" \
              ".\Release\IDL\gen-any.obj" \
              ".\Release\IDL\gen-code.obj" \
              ".\Release\IDL\gen-vals.obj" \
              ".\Release\IDL\rules.obj" \
              ".\Release\IDL\types.obj" \
              ".\core\cond.obj" \
              ".\core\str-util.obj" \
              ".\core\tag-util.obj" \
            $(STDCC_LIBS) \
            $(REQ_LIBS)
$(LINK_EXE) /out:$(OUT_PUT)\esnacc.exe \
### All the corresponding .obj files of CPP files
    "$(INTDIR)\define.obj" \
    "$(INTDIR)\dependency.obj" \
    "$(INTDIR)\do-macros.obj" \
    "$(INTDIR)\enc-rules.obj" \
    "$(INTDIR)\err-chk.obj" \
    "$(INTDIR)\exports.obj" \
    "$(INTDIR)\gen-tbls.obj" \
    "$(INTDIR)\gfsi.obj" \
    "$(INTDIR)\lex-asn1.obj" \
    "$(INTDIR)\lib-types.obj" \
    "$(INTDIR)\link-types.obj" \
    "$(INTDIR)\link-values.obj" \
    "$(INTDIR)\mem.obj" \
    "$(INTDIR)\meta.obj" \
    "$(INTDIR)\normalize.obj" \
    "$(INTDIR)\oid.obj" \
    "$(INTDIR)\parse-asn1.obj" \
    "$(INTDIR)\print.obj" \
    "$(INTDIR)\recursive.obj" \
    "$(INTDIR)\snacc-util.obj" \
    "$(INTDIR)\snacc.obj" \
    "$(INTDIR)\tbl.obj" \
    "$(INTDIR)\val-parser.obj" \
    "$(INTDIR)\gen-any.obj" \
    "$(INTDIR)\gen-code.obj" \
    "$(INTDIR)\gen-dec.obj" \
    "$(INTDIR)\gen-enc.obj" \
    "$(INTDIR)\gen-free.obj" \
    "$(INTDIR)\gen-print.obj" \
    "$(INTDIR)\gen-type.obj" \
    "$(INTDIR)\gen-vals.obj" \
    "$(INTDIR)\kwd.obj" \
    "$(INTDIR)\rules.obj" \
    "$(INTDIR)\type-info.obj" \
    "$(INTDIR)\util.obj" \
    "$(INTDIR)\cxxconstraints.obj" \
    "$(INTDIR)\cxxmultipleconstraints.obj" \
    ".\Release\C++\gen-any.obj" \
    ".\Release\C++\gen-code.obj" \
    ".\Release\C++\gen-vals.obj" \
    ".\Release\C++\kwd.obj" \
    ".\Release\C++\rules.obj" \
    ".\Release\C++\types.obj" \
    ".\Release\IDL\gen-any.obj" \
    ".\Release\IDL\gen-code.obj" \
    ".\Release\IDL\gen-vals.obj" \
    ".\Release\IDL\rules.obj" \
    ".\Release\IDL\types.obj" \
    "$(INTDIR)\cond.obj" \
    "$(INTDIR)\str-util.obj" \
    "$(INTDIR)\tag-util.obj" \
  $(STDCC_LIBS) \
  $(REQ_LIBS)
====================================================


the batch file is as follows

call VCVARS32.BAT

set SNACC_HOME=D:\SAMEER\SnaccDownload\SNACC

NMAKE -f compiler.makefile BUILD_TYPE=Release SOURCE_DIR=.\;
OUTPUT_DIR=.\Release INT_DIR=.\Release

=======================================================

the error I am getting is ,

        CL /nologo /MD /DTHREAD  /MDd /W3 /Gm- /GR /GX /ZI /Od /D "WIN32" 
/D "_DEBUG" /D "_CONSOLE" /D "_MBCS"  /D "_USRDLL"
/D "_DEBUG_TRACE_" /D "_INFO_"  /Fo".\Release/" /Fd".\Release/" /FD /GZ /c
-I.  -ID:\SAMEER\SnaccDownload\SNACC  -ID:\SAMEER\S
naccDownload\SNACC\c-lib\inc  -ID:\SAMEER\SnaccDownload\SNACC\c++-lib\inc 
-ID:\SAMEER\SnaccDownload\SNACC\compiler  -ID:\SAME
ER\SnaccDownload\SNACC\compiler\core 
-ID:\SAMEER\SnaccDownload\SNACC\compiler\back-ends 
-ID:\SAMEER\SnaccDownload\SNACC\comp
iler\back-ends\c++-gen  -I\VC98\Include  -c /Tp ".\core\define.C"
Command line warning D4025 : overriding '/MD' with '/MDd'
define.C
d:\sameer\snaccdownload\snacc\compiler\core\define.c(66) : error C2065:
'FALSE' : undeclared identifier
d:\sameer\snaccdownload\snacc\compiler\core\define.c(69) : error C2065:
'TRUE' : undeclared identifier
d:\sameer\snaccdownload\snacc\compiler\core\define.c(125) : error C2059:
syntax error : 'new'
d:\sameer\snaccdownload\snacc\compiler\core\define.c(127) : error C2059:
syntax error : '='
d:\sameer\snaccdownload\snacc\compiler\core\define.c(128) : error C2059:
syntax error : '->'
d:\sameer\snaccdownload\snacc\compiler\core\define.c(131) : error C2059:
syntax error : '->'
d:\sameer\snaccdownload\snacc\compiler\core\define.c(132) : error C2059:
syntax error : ';'
d:\sameer\snaccdownload\snacc\compiler\core\define.c(134) : error C2143:
syntax error : missing ';' before '}'
d:\sameer\snaccdownload\snacc\compiler\core\define.c(134) : error C2143:
syntax error : missing ';' before '}'
d:\sameer\snaccdownload\snacc\compiler\core\define.c(134) : error C2143:
syntax error : missing ';' before '}'



-- 
View this message in context: http://www.nabble.com/Makefile-for-building-the-snacc-compiler-tf4022880.html#a11426233
Sent from the Gnu - SNACC mailing list archive at Nabble.com.






More information about the dev mailing list