home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c100 / 3.ddi / STARTUP.ZIP / EXAMPLES / STDIO / MAKEFILE next >
Encoding:
Text File  |  1990-09-01  |  3.0 KB  |  122 lines

  1. #
  2. #    Sample makefile for building an embedded system demonstration of
  3. #    stream I/O using the Turbo C++ 1.0 compiler.
  4. #
  5. #    Some of the macros used in this makefile are
  6. #
  7. #        MODEL        Selected memory model
  8. #        HUGE        True if huge memory model
  9. #        DEBUG        True if debug information is enabled
  10. #        TDREM        True if output to be debugged with the Turbo Debugger
  11. #        FLOAT        Floating point library selection
  12. #        CFG        Paradigm LOCATE configuration file extension (see below)
  13. #        OUT        Output file extension
  14. #        STACK        Set application stack size
  15. #
  16. #    Paradigm LOCATE configuration file naming conventions are
  17. #
  18. #        RM            EPROM small, medium, compact and large memory models
  19. #        TD            Turbo Debugger small, medium, compact and large memory models
  20. #
  21.  
  22. MKF        =    makefile
  23. CC            =    tcc                    # Turbo C++ command line compiler
  24. ASM        =    tasm                    # Assembler to use (TASM/MASM/OPTASM)
  25. LINK        =    tlink                    # Linker to use
  26. LOCATE    =    locate                # Paradigm LOCATE
  27. ROMLIBS    =    c:\tc\lib            # ROM libraries path (change to yours)
  28. TCPPLIBS    =    c:\tc\lib            # Turbo C++ libraries (for floating point)
  29.  
  30. MODEL        =    l                # s, m, c, l, h
  31. HUGE        =    0                # 1 if huge memory model, 0 otherwise
  32.  
  33. DEBUG        =    1                # 0 - no debug info, 1 - debug info
  34. FLOAT        =    0                # 0 - none, 1 - not used, 2 - emulator, 3 - 80x87
  35. TDREM        =    0                # 0 - ROM build, 1 - TDREM build
  36. STACK        =    2048            # Application stack size (in bytes)
  37.  
  38. AINCLUDE    =    .
  39. AFLAGS    =    /mx /D__$(MODEL)__ /i$(AINCLUDE) /DSTKSIZE=$(STACK)
  40. CFLAGS    =    -c -m$(MODEL)
  41. TFLAGS    =    /c /v
  42. LIBS        =    $(ROMLIBS)\c$(MODEL)
  43.  
  44. #    Check if including debug info
  45. !if    $(DEBUG) == 0
  46. CFLAGS    =    $(CFLAGS) -v-
  47. !else
  48. CFLAGS    =    $(CFLAGS) -v
  49. !endif
  50.  
  51. #    Process the selected floating point option
  52. !if    $(FLOAT) == 0
  53. CFLAGS    =    $(CFLAGS) -f-
  54. !elif    $(FLOAT) == 2
  55. CFLAGS    =    $(CFLAGS) -f
  56. AFLAGS    =    $(AFLAGS) /DFLOAT=$(FLOAT)
  57. LIBS        =    $(TCPPLIBS)\emu $(ROMLIBS)\math$(MODEL) $(LIBS)
  58. !elif    $(FLOAT) == 3
  59. CFLAGS    =    $(CFLAGS) -f87
  60. AFLAGS    =    $(AFLAGS) /DFLOAT=$(FLOAT)
  61. LIBS        =    $(TCPPLIBS)\fp87 $(ROMLIBS)\math$(MODEL) $(LIBS)
  62. !else
  63. !error    Invalid floating point option selected
  64. !endif
  65.  
  66. #    Process the selected TDREM option
  67. !if    $(TDREM) == 0
  68. LOCFLGS    =    -b -h
  69. OUT        =    hex
  70. CFG        =    rm
  71. !undef    TDREM
  72. !elif    $(TDREM) == 1
  73. LOCFLGS    =    -t
  74. OUT        =    exe
  75. CFG        =    td
  76. AFLAGS    =    $(AFLAGS) /DTDREM
  77. CFLAGS    =    $(CFLAGS) -DTDREM
  78. !else
  79. !error    Invalid TDREM option selected
  80. !endif
  81.  
  82. #    Add the huge model compiler segment changes
  83. !if    $(HUGE) == 1
  84. CFLAGS    =    $(CFLAGS) -zBHUGEBSS -zD$*_BSS
  85. !endif
  86.  
  87. .c.obj:
  88.     $(CC) $(CFLAGS) {$*.c }
  89.  
  90. .asm.obj:
  91.     $(ASM) $(AFLAGS) $* ;
  92.  
  93.  
  94. #
  95. #    The remainder of the make file is the targets and dependancies
  96. #
  97.  
  98. OBJS        =    tcpp10.obj stdio.obj dosemu.obj conio.obj tcpprtl.obj
  99.  
  100.  
  101. stdio.$(OUT):    stdio.rom tcpp10.$(CFG)
  102.     $(LOCATE) -ctcpp10.$(CFG) $(LOCFLGS) $*
  103.  
  104. stdio.rom:        $(OBJS)
  105.     $(LINK) $(TFLAGS) @&&!
  106. $(OBJS)
  107. $*.rom
  108. $*.map
  109. $(LIBS)
  110. !
  111.  
  112.  
  113. stdio.obj:            stdio.c $(MKF)
  114.  
  115. dosemu.obj:            dosemu.c typedefs.h dosemu.h $(MKF)
  116.  
  117. conio.obj:            conio.c typedefs.h dosemu.h $(MKF)
  118.  
  119. tcpprtl.obj:        tcpprtl.asm tcpp10.inc $(MKF)
  120.  
  121. tcpp10.obj:            tcpp10.asm tcpp10.inc $(MKF)
  122.