home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ioctlapi.zip / appsrc.zip / makefile < prev    next >
Makefile  |  1999-09-15  |  6KB  |  179 lines

  1. ###############################################################################
  2. #
  3. # BUILD PROCEDURE
  4. #
  5. # "wmake"  (Watcom C/C++ WMAKE.exe)
  6. #
  7. # Environment variables:
  8. #    PRODUCTION - yes/no (default no)
  9. #    TOOLS      - Location of Build Machine "tools" directory (e.g. X:\TOOLS)
  10. #    INCLUDE    - Should not be defined in environment
  11. #    LIB        - Should not be defined in environment
  12. #    PATH       - Is set by makefile to include TOOLS\OS2\DDK\TOOLS and
  13. #                 Watcom BINP and BINW dirs (OS2 build environment) and
  14. #                 Watcom BINNT, BINW dirs  (Windows 95/NT build environment)
  15. #    DEVCOPY    - Optional.  Extra directory to copy driver to (for development)
  16. #
  17. # TOOLKITS, DDKs and Compilers:
  18. #    Watcom C/C++ 11.0B - Installed to TOOLS\OS2\WATCOM
  19. #    IBM OS/2 Toolkit   - Installed to TOOLS\OS2\TOOLKIT
  20. #    IBM OS/2 DDK       - Installed to TOOLS\OS2\DDK (used for mapsym only)
  21. #
  22. #################################################################################
  23.  
  24. # Erase partially created targets after an error
  25. .ERASE
  26.  
  27. .EXTENSIONS:
  28. .EXTENSIONS: .sys .obj .asm .inc .def .lrf .ref .lst .sym .map .c .cpp .h .lib
  29.  
  30. .BEFORE
  31. !ifndef %TOOLS
  32.    !error Environment variable TOOLS must be set (e.g. SET TOOLS=Y:\TOOLS)
  33. !endif
  34. !ifndef %WATCOM
  35.    set WATCOM=$(%TOOLS)\OS2\WATCOM
  36. !endif
  37. MASM60=$(%TOOLS)\OS2\MASM60
  38. WAT=$(%WATCOM)
  39.  
  40. DDK=$(%TOOLS)\OS2\DDK
  41. DDK_TOOLS=$(DDK)\BASE\TOOLS
  42. DDK_LIB=$(DDK)\BASE\LIB
  43. DDK_H=$(DDK)\BASE\H
  44. DDK_INC=$(DDK)\BASE\INC
  45. TK=$(%TOOLS)\OS2\TOOLKIT
  46. TK_BIN=$(TK)\BIN
  47. TK_LIB=$(TK)\LIB
  48. TK_H=$(TK)\H
  49.    set INCLUDE=
  50.    set LIB=
  51.    set PATH=$(WAT)\BINNT;$(WAT)\BINW;$(WAT)\BINP;$(TK_BIN)
  52.  
  53. NAME        = IOCTL90
  54.  
  55. ##########################################
  56. # Options for Watcom 32-bit C/C++ compiler
  57. ##########################################
  58. #  -bt=os2   = Build target OS is OS/2
  59. #  -ms       = Memory model small
  60. #  -mf       = Memory model flat
  61. #  -3        = Enable use of 80386 instructions
  62. #  -4        = Optimize for 486 (assumes -3)
  63. #  -5        = Optimize for Pentium (assumes -3)
  64. #  -j        = char default is unsigned
  65. #  -d1       = Include line number info in object
  66. #              (necessary to produce assembler listing)
  67. #  -d2       = Include debugging info for ICAT (+20KB hit in .SYS size)
  68. #  -fo       = Specify name of produced object file
  69. #  -hc       = Codeview style debug info (necessary for ICAT)
  70. #  -o        = Optimization - i = enable inline intrinsic functions
  71. #                             r = optimize for 80486 and pentium pipes
  72. #                             s = space is preferred to time
  73. #                             l = enable loop optimizations
  74. #                             a = relax aliasing constraints
  75. #                             n = allow numerically unstable optimizations
  76. #  -s        = Omit stack size checking from start of each function
  77. #  -zl       = Place no library references into objects
  78. #  -wx       = Warning level set to maximum (vs 1..4)
  79. #  -zfp      = Prevent use of FS selector
  80. #  -zgp      = Prevent use of GS selector
  81. #  -zq       = Operate quietly
  82. #  -zm       = Put each function in its own segment
  83. #  -zu       = Do not assume that SS contains segment of DGROUP
  84.  
  85. !ifeq %production yes
  86. #undef DEBUG
  87. !else
  88. DEBUG=-DDEBUG
  89. !endif
  90.  
  91. CC=wcc386
  92. CPP=wpp386
  93. CINC=-i=$(WAT)\H -i=$(TK_H) -i=$(WAT)\H\OS2 
  94. CFLAGS=-5 -bt=os2 -d1 -oi -s -w4 -zq $(CINC) $(DEBUG)
  95.  
  96. ##########################################
  97. # Options for Microsoft MASM 6.00B (Last OS/2 version of MASM)
  98. ##########################################
  99. #    -Cx Preserve case in publics
  100. #    -Sn Supress symbol table listing
  101. #    -Fl Generate listing
  102.  
  103. ASM     = $(MASM60)\binp\ml
  104. AFLAGS  = -c -Cx -Sn -Fl
  105. AINC    = -I$(DDK_INC)
  106.  
  107. ##########################################
  108. # Options for linker.
  109. ##########################################
  110. LINK=wlink
  111. WMAPNAME=mapfile
  112.  
  113. ##########################################
  114. # Options for Watcom disassembler
  115. ##########################################
  116. WDISFLAGS=-e -p -l -m -s
  117.  
  118. #########################################
  119. # Inference rules
  120. #########################################
  121.  
  122. .c.obj: .AUTODEPEND
  123.    $(CC) $(CFLAGS) -Fo$*.obj $*.c
  124.    wdis -e -p -l -s $*
  125.  
  126. .cpp.obj: .AUTODEPEND
  127.    $(CPP) $(CFLAGS) -Fo$*.obj $*.cpp
  128.    wdis $(WDISFLAGS) $*
  129.    
  130. .asm.obj: .AUTODEPEND
  131.    $(ASM) $(AFLAGS) $(AINC) -Fo$*.obj -Fl$*.lst $*.asm
  132.  
  133. OBJS1=asciinum.obj callback.obj commands.obj data.obj help.obj main.obj
  134. OBJS2=mixerapi.obj parse.obj pddname.obj util.obj
  135. OBJS=$(OBJS1) $(OBJS2)
  136.  
  137. all: $(NAME).exe $(NAME).sym
  138.  
  139. $(NAME).lrf: makefile
  140.    @%write $^@ system os2v2
  141.    @%write $^@ option quiet
  142.    @%write $^@ option verbose
  143.    @%write $^@ option caseexact
  144.    @%write $^@ option symfile=$(NAME).dbg
  145.    @%write $^@ option cache
  146.    @%write $^@ option map=$(WMAPNAME).
  147.    @%write $^@ name $(NAME).exe
  148.    @for %f in ($(OBJS)) do @%append $^@ file %f
  149.    @%write $^@ library $(TK_LIB)\OS2386.LIB
  150.    @%write $^@ library $(TK_LIB)\MMPM2.LIB
  151.  
  152. $(NAME).exe: $(OBJS) $(NAME).lrf
  153.    $(LINK) @$(NAME).lrf
  154. !ifdef %DEVCOPY
  155.    copy $*.exe %DEVCOPY%
  156. !endif
  157.  
  158. $(NAME).sym: $(WMAPNAME)
  159.    ..\util\wat2map $(WMAPNAME) $(NAME).map
  160.    $(DDK_TOOLS)\MAPSYM $(NAME).map
  161. !ifdef %DEVCOPY
  162.    copy $*.sym %DEVCOPY%
  163. !endif
  164.  
  165. # Enable display of environment via "wmake env"
  166. env: .SYMBOLIC
  167.    @set
  168.  
  169. clean: .SYMBOLIC
  170.    @for %f in ($(OBJS)) do @if exist %f erase %f
  171.    @if exist $(NAME).EXE erase $(NAME).EXE
  172.    @if exist $(NAME).SYM erase $(NAME).SYM
  173.    @if exist $(NAME).MAP erase $(NAME).MAP
  174.    @if exist $(NAME).LRF erase $(NAME).LRF
  175.    @if exist $(WMAPNAME) erase $(WMAPNAME)
  176.    @if exist *.LST             erase *.LST
  177.    @if exist *.ERR             erase *.ERR
  178.    @if exist list              erase list
  179.