home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 12 / CD_ASCQ_12_0294.iso / vrac / epmgcc10.zip / EPRO.CMD next >
OS/2 REXX Batch file  |  1994-02-08  |  23KB  |  647 lines

  1. /* REXX
  2. ┌──────────────────────────────────────────────────────────────────────────────┐
  3. │                            EditProject Version 0.60                          │
  4. │                                                                              │
  5. │                          Makefile maintenance utility                        │
  6. │                                                                              │
  7. │                               Bernhard Bablok                                │
  8. │                                                                              │
  9. │                                January, 1994                                 │
  10. │                                                                              │
  11. │   Distributed as part of the EPMGCC-package. See the file license.txt for    │
  12. │   details on the legal stuff. See the file epro.doc for details on usage.    │
  13. │                                                                              │
  14. └──────────────────────────────────────────────────────────────────────────────┘
  15. */
  16.  
  17. PARSE ARG Project.file
  18. CALL startup
  19.  
  20. IF Project.file = '' THEN
  21.   CALL SelectProject
  22. ELSE DO
  23.   Project.file = STRIP(Project.file)
  24.   CALL SysFileTree Project.file, 'count', 'FO'
  25.   IF count.0 = 0 THEN DO                       /* project file doesn't exist! */
  26.     extension = SUBSTR(Project.file,LASTPOS('.',Project.file)+1)
  27.     IF extension = Project.file THEN
  28.        Project.file = Project.file'.emx'
  29.     SelectProject.template = Project.file
  30.     CALL SelectProject
  31.     IF RESULT > 0 THEN DO
  32.       Project.name = '.unnamed'
  33.       SelectProject.template = '*.emx'
  34.       main.vstring = 1
  35.     END
  36.   END
  37.   ELSE DO
  38.      CALL ReadProject
  39.      IF RESULT > 0 THEN DO
  40.        Project.name = '.unnamed'
  41.        SelectProject.template = '*.emx'
  42.        main.vstring = 1
  43.      END
  44.   END
  45. END
  46. CALL MainMenu
  47. CALL cleanup
  48.  
  49. /*----------------------------------------------------------------------------*/
  50. /* startup: Initialize functions and variables                                */
  51. /*----------------------------------------------------------------------------*/
  52. startup:
  53.  
  54. EditProject.version  = 0.60
  55. EditProject.compiler = 'gcc'
  56. EditProject.make     = 'make'
  57.  
  58. main.0       = 8
  59. main.1       = 'Select project'
  60. main.2       = 'Add files'
  61. main.3       = 'Delete files'
  62. main.4       = 'Build options'
  63. main.5       = 'Compiler options'
  64. main.6       = 'Link options'
  65. main.7       = 'Save project'
  66. main.8       = 'Make'
  67.  
  68. SelectProject.title    = 'Select project'
  69. SelectProject.template = '*.emx'
  70.  
  71. AddFiles.title    = 'Add file'
  72. AddFiles.template = '*.c'
  73.  
  74. sources.0      = 0
  75. sources.title  = 'Added files'
  76. sources.back   = 'BLUE'
  77. sources.fore   = 'WHITE'
  78. sources.type   = 'SYSTEM'                             /* font                 */
  79. sources.size   = 10                                   /* pitch                */
  80. sources.left   = 1                                    /* position of window   */
  81. sources.bottom = 5
  82. sources.right  = 20
  83. sources.top    = 95
  84. sources.diff   = 25                                   /* distance betw. lines */
  85. sources.all    = ''                                   /* all sources          */
  86.  
  87. DeleteFiles.title  = 'Delete files'
  88. DeleteFiles.width  = 20
  89. DeleteFiles.height = 10
  90.  
  91. BuildOption.title  = 'Build-Mode'
  92. BuildOption.0      = 2
  93. BuildOption.1      = 'Debug'
  94. BuildOption.2      = 'Production'
  95.  
  96. CompilerOptions.title    = 'Compiler options'
  97. CompilerOptions.prompt.0 = 3
  98. CompilerOptions.prompt.1 = 'Global options:'
  99. CompilerOptions.prompt.2 = 'Debug options:'
  100. CompilerOptions.prompt.3 = 'Production options:'
  101.  
  102. CompilerOptions.width.0  = 3
  103. CompilerOptions.width.1  = 60
  104. CompilerOptions.width.2  = 60
  105. CompilerOptions.width.3  = 60
  106.  
  107. CompilerOptions.hide.    = 0
  108. CompilerOptions.hide.0   = 3
  109.  
  110. CompilerOptions.return.0 = 3
  111.  
  112. LinkOptions.title    = 'Link options'
  113. LinkOptions.prompt.0 = 3
  114. LinkOptions.prompt.1 = 'Global options:'
  115. LinkOptions.prompt.2 = 'Debug options:'
  116. LinkOptions.prompt.3 = 'Production options:'
  117.  
  118. LinkOptions.width.0  = 3
  119. LinkOptions.width.1  = 60
  120. LinkOptions.width.2  = 60
  121. LinkOptions.width.3  = 60
  122.  
  123. LinkOptions.hide.    = 0
  124. LinkOptions.hide.0   = 3
  125.  
  126. LinkOptions.return.0 = 3
  127.  
  128. /*----------------------------------------------------------------------------*/
  129. /* Definitions for message boxes                                              */
  130. /*----------------------------------------------------------------------------*/
  131.  
  132. SaveProject.title  = 'Save project'
  133. SaveProject.0      = 2
  134. SaveProject.1      = 'Project information has changed.'
  135. SaveProject.2      = 'Save information?'
  136.  
  137. NotImplemented.title = 'Sorry!'
  138. NotImplemented.0     = 1
  139. NotImplemented.1     = 'Option not implemented'
  140.  
  141. WrongVersion.title = 'Sorry!'
  142. WrongVersion.0     = 1
  143. WrongVersion.1     = 'No EditProject makefile or wrong version'
  144. WrongVersion.2     = 'wrong version'
  145.  
  146. DeleteFileProblem.title = 'Problem!'
  147. DeleteFileProblem.0 = 2
  148. DeleteFileProblem.1 = 'Could not delete old makefile!'
  149. DeleteFileProblem.2 = 'Change access flags and try again.'
  150.  
  151. UnnamedProject.title = 'Problem!'
  152. UnnamedProject.0     = 2
  153. UnnamedProject.1     = 'No name defined for project!'
  154. UnnamedProject.2     = 'Define a name and try again.'
  155.  
  156. /*----------------------------------------------------------------------------*/
  157. /* Initialize REXX-function-package                                           */
  158. /*----------------------------------------------------------------------------*/
  159.  
  160. IF RxFuncQuery('SysLoadFuncs') THEN DO
  161.   CALL RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
  162.   CALL SysLoadFuncs
  163. END
  164.  
  165. /*----------------------------------------------------------------------------*/
  166. /* Initialize VREXX-function-package                                          */
  167. /*----------------------------------------------------------------------------*/
  168.  
  169. CALL RxFuncAdd 'VInit', 'VREXX', 'VInit'
  170. RC = VInit()
  171. IF RC = 'ERROR' THEN
  172.   SIGNAL cleanup
  173. SIGNAL ON ERROR   NAME cleanup
  174. SIGNAL ON FAILURE NAME cleanup
  175. SIGNAL ON HALT    NAME cleanup
  176. SIGNAL ON SYNTAX  NAME cleanup
  177.  
  178. OK       = 1
  179. CANCEL   = 2
  180. OKCANCEL = 3
  181. YES      = 4
  182. NO       = 5
  183. YESNO    = 6
  184.  
  185. RETURN
  186.  
  187. /*----------------------------------------------------------------------------*/
  188. /* SetDefaults: Set project-defaults for a new project                        */
  189. /*----------------------------------------------------------------------------*/
  190. SetDefaults:
  191.  
  192. Project.mode                      = BuildOption.1
  193. Project.GlobalCompilerOptions     = ''
  194. Project.DebugCompilerOptions      = ''
  195. Project.ProductionCompilerOptions = ''
  196. Project.GlobalLinkOptions         = ''
  197. Project.DebugLinkOptions          = ''
  198. Project.ProductionLinkOptions     = ''
  199. Project.status                    = 'SAVED'          /* no changes yet!       */
  200. sources.all                       = ''
  201. sources.0                         = 0
  202.  
  203. RETURN 0
  204.  
  205. /*----------------------------------------------------------------------------*/
  206. /* ReadProject: Read makefile of existing project                             */
  207. /*----------------------------------------------------------------------------*/
  208. ReadProject:
  209.  
  210. line = LINEIN(Project.file)
  211. line = LINEIN(Project.file)
  212. IF WORD(line,5) <> 'EditProject' | WORD(line,7) < 0.6 THEN DO
  213.   CALL VMsgBox WrongVersion.title, WrongVersion, OK
  214.   DROP makefile.
  215.   RETURN 16
  216. END
  217.  
  218. DO WHILE LINES(Project.file) > 0
  219.   line = LINEIN(Project.file)
  220.   SELECT
  221.     WHEN WORD(line,1) = 'MODE' THEN DO
  222.       IF SUBSTR(line,WORDINDEX(line,3),1) = 'D' THEN
  223.          Project.mode = BuildOption.1
  224.       ELSE
  225.          Project.mode = BuildOption.2
  226.     END
  227.  
  228.     WHEN WORD(line,1) = 'G_CFLAGS' THEN DO
  229.       IF WORD(line,3) <> '' THEN
  230.         Project.GlobalCompilerOptions = SUBSTR(line,WORDINDEX(line,3))
  231.       ELSE
  232.         Project.GlobalCompilerOptions = ''
  233.     END
  234.     WHEN WORD(line,1) = 'D_CFLAGS' THEN DO
  235.       IF WORD(line,3) <> '' THEN
  236.         Project.DebugCompilerOptions = SUBSTR(line,WORDINDEX(line,3))
  237.       ELSE
  238.         Project.DebugCompilerOptions = ''
  239.     END
  240.     WHEN WORD(line,1) = 'P_CFLAGS' THEN DO
  241.       IF WORD(line,3) <> '' THEN
  242.         Project.ProductionCompilerOptions = SUBSTR(line,WORDINDEX(line,3))
  243.       ELSE
  244.         Project.ProductionCompilerOptions = ''
  245.     END
  246.  
  247.     WHEN WORD(line,1) = 'G_LFLAGS' THEN DO
  248.       IF WORD(line,3) <> '' THEN
  249.         Project.GlobalLinkOptions = SUBSTR(line,WORDINDEX(line,3))
  250.       ELSE
  251.         Project.GlobalLinkOptions = ''
  252.     END
  253.     WHEN WORD(line,1) = 'D_LFLAGS' THEN DO
  254.       IF WORD(line,3) <> '' THEN
  255.         Project.DebugLinkOptions = SUBSTR(line,WORDINDEX(line,3))
  256.       ELSE
  257.         Project.DebugLinkOptions = ''
  258.     END
  259.     WHEN WORD(line,1) = 'P_LFLAGS' THEN DO
  260.       IF WORD(line,3) <> '' THEN
  261.         Project.ProductionLinkOptions = SUBSTR(line,WORDINDEX(line,3))
  262.       ELSE
  263.         Project.ProductionLinkOptions = ''
  264.     END
  265.  
  266.     WHEN WORD(line,1) = 'SOURCES' THEN DO
  267.       IF WORD(line,3) <> '' THEN
  268.         sources.all = SUBSTR(line,WORDINDEX(line,3))
  269.       ELSE
  270.         sources.all = ''
  271.       sources.0 = STRIP(WORDS(sources.all))
  272.       DO i = 1 TO sources.0
  273.         sources.i = STRIP(WORD(sources.all,i))
  274.       END
  275.     END
  276.  
  277.     WHEN WORD(line,1) = 'VPATH' THEN DO
  278.       Project.dir = TRANSLATE(WORD(line,3)'/','\','/')
  279.       LEAVE
  280.     END
  281.     OTHERWISE NOP
  282.   END
  283. END
  284. CALL LINEOUT Project.file
  285.  
  286. main.vstring   = main.5
  287. Project.status = 'SAVED'
  288. Project.name   = FILESPEC("name",Project.file)
  289. PARSE VALUE Project.name WITH Project.Project '.' Project.environment
  290. Project.environment = TRANSLATE(Project.environment)
  291. IF Project.environment <> 'GCC' THEN
  292.   Project.environment = 'EMX'
  293. SelectProject.template = Project.dir'*.'Project.environment
  294.  
  295. RETURN 0
  296.  
  297. /*----------------------------------------------------------------------------*/
  298. /* cleanup: Release of VREXX-resources                                        */
  299. /*----------------------------------------------------------------------------*/
  300. cleanup:
  301.  
  302. CALL VExit
  303. EXIT
  304.  
  305. /*----------------------------------------------------------------------------*/
  306. /* MainMenu: Show a dialog-box until CANCEL                                   */
  307. /*----------------------------------------------------------------------------*/
  308. MainMenu:
  309.  
  310. DO FOREVER
  311.   CALL VDialogPos 50, 50
  312.   CALL VRadioBox  'Project 'project.name, main, OKCANCEL
  313.   IF RESULT = 'CANCEL' THEN DO
  314.     IF project.status = 'CHANGED' THEN DO
  315.       CALL VMsgBox SaveProject.title, SaveProject, YESNO
  316.       IF RESULT = 'YES' THEN DO
  317.         CALL WriteProject
  318.         IF RESULT = 0 THEN
  319.           LEAVE
  320.       END
  321.       ELSE
  322.         LEAVE
  323.     END
  324.     ELSE
  325.       LEAVE
  326.   END
  327.   ELSE DO
  328.     SELECT
  329.       WHEN main.vstring = main.1 THEN
  330.         CALL SelectProject
  331.       WHEN main.vstring = main.2 THEN
  332.         CALL AddFiles
  333.       WHEN main.vstring = main.3 THEN
  334.         CALL DeleteFiles
  335.       WHEN main.vstring = main.4 THEN
  336.         CALL DefineBuildOption
  337.       WHEN main.vstring = main.5 THEN
  338.         CALL DefineCompilerOptions
  339.       WHEN main.vstring = main.6 THEN
  340.         CALL DefineLinkOptions
  341.       WHEN main.vstring = main.7 THEN
  342.         CALL WriteProject
  343.       WHEN main.vstring = main.8 THEN
  344.         CALL ExecuteMakefile
  345.       OTHERWISE DO
  346.         CALL VDialogPos 75, 25
  347.         CALL VMsgBox NotImplemented.title, NotImplemented, OK
  348.       END    /* OTHERWISE DO */
  349.     END    /* SELECT */
  350.   END    /* ELSE DO */
  351. END    /* DO FOREVER */
  352.  
  353. RETURN
  354.  
  355. /*----------------------------------------------------------------------------*/
  356. /* SelectProject: Display a file selection box for the makefile               */
  357. /*----------------------------------------------------------------------------*/
  358. SelectProject:
  359.  
  360. IF project.status = 'CHANGED' THEN DO
  361.   CALL VMsgBox SaveProject.title, SaveProject, YESNO
  362.   IF RESULT = 'YES' THEN DO
  363.     CALL WriteProject
  364.     IF RESULT > 0 THEN
  365.       RETURN
  366.   END
  367. END
  368.  
  369. Project.vstring = Project.file
  370. CALL VFileBox SelectProject.title, SelectProject.template, 'Project'
  371. IF RESULT <> 'CANCEL' THEN DO
  372.    Project.status = 'CHANGED'
  373.    Project.file   = Project.vstring
  374.  
  375.    Project.name   = FILESPEC("name",Project.vstring)
  376.    PARSE VALUE Project.name WITH Project.project '.' Project.environment
  377.    Project.environment = TRANSLATE(Project.environment)
  378.    IF Project.environment <> 'GCC' THEN
  379.      Project.environment = 'EMX'
  380.  
  381.    Project.dir    = FILESPEC("drive",Project.vstring) ||,
  382.                     FILESPEC("path",Project.vstring)
  383.    SelectProject.template = Project.dir'*.'Project.environment
  384.  
  385.    CALL SysFileTree Project.file, 'count', 'FO'
  386.    IF count.0 = 0 THEN                         /* project file doesn't exist! */
  387.      CALL SetDefaults
  388.    ELSE
  389.      CALL ReadProject
  390.      IF RESULT > 0 THEN DO
  391.        Project.name = '.unnamed'
  392.        SelectProject.template = '*.emx'
  393.        main.vstring = 1
  394.      END
  395.    DROP count.
  396.    RETURN 0
  397. END
  398. RETURN 1
  399.  
  400. /*----------------------------------------------------------------------------*/
  401. /* AddFiles: Add source-files to the project                                  */
  402. /*----------------------------------------------------------------------------*/
  403. AddFiles:
  404.  
  405. sources.id = VOpenWindow(sources.title,sources.back,sources)
  406. CALL VSetFont sources.id, sources.type, sources.size
  407. sources.linenr = 1000
  408.  
  409. CALL VForeColor sources.id, sources.fore
  410. DO i = 1 TO sources.0
  411.   sources.linenr = sources.linenr - sources.diff
  412.   CALL VSay sources.id, 5, sources.linenr, sources.i
  413. END
  414.  
  415. DO FOREVER
  416.    CALL VFileBox AddFiles.title, Project.dir||AddFiles.template, 'AddFiles'
  417.    IF RESULT = 'CANCEL' THEN
  418.      LEAVE
  419.    ELSE IF WORDPOS(FILESPEC("name",AddFiles.vstring),sources.all) = 0 THEN DO
  420.      Project.status = 'CHANGED'
  421.      sources.0      = sources.0 + 1
  422.      i              = sources.0
  423.      sources.i      = FILESPEC("name",AddFiles.vstring)
  424.      sources.all    = sources.all sources.i
  425.      sources.linenr = sources.linenr - sources.diff
  426.      CALL VForeColor sources.id, sources.fore
  427.      CALL VSay       sources.id, 5, sources.linenr, sources.i
  428.    END   /* ELSE DO */
  429. END    /* DO FOREVER */
  430.  
  431. CALL VCloseWindow sources.id
  432. RETURN
  433.  
  434. /*----------------------------------------------------------------------------*/
  435. /* DeleteFiles: Remove files from project list                                */
  436. /*----------------------------------------------------------------------------*/
  437. DeleteFiles:
  438.  
  439. CALL VDialogPos 75, 50
  440. DO FOREVER
  441.   IF words(sources.all) = 0 THEN
  442.     LEAVE
  443.   CALL VListBox DeleteFiles.title, sources, DeleteFiles.width,,
  444.                 DeleteFiles.height, OKCANCEL
  445.   IF RESULT = 'CANCEL' THEN
  446.     LEAVE
  447.   ELSE DO
  448.     Project.status = 'CHANGED'
  449.     IF WORDS(sources.all) = 1 THEN
  450.       sources.all = ''
  451.     ELSE
  452.       sources.all = DELWORD(sources.all,WORDPOS(sources.vstring,sources.all),1)
  453.     DO i=1 TO sources.0
  454.       IF sources.i <> sources.vstring THEN
  455.         ITERATE
  456.       ELSE DO
  457.         IF sources.0 = 1 THEN DO
  458.           sources.0 = 0
  459.           sources.1 = ''
  460.         END
  461.         ELSE DO
  462.           sources.0 = sources.0 - 1
  463.           DO i=i TO sources.0
  464.             nexti = i + 1
  465.             sources.i = sources.nexti
  466.           END
  467.         END          /* ELSE DO (IF sources.0 = 1)               */
  468.         LEAVE        /* DO i=1 TO sources.0                      */
  469.       END          /* ELSE DO  (IF sources.i <> sources.vstring) */
  470.     END          /* DO i=1 TO sources.0                          */
  471.   END          /* ELSE DO                                        */
  472. END          /* DO FOREVER                                       */
  473.  
  474. RETURN
  475.  
  476. /*----------------------------------------------------------------------------*/
  477. /* DefineBuildOption: Choose between debug- and production-mode               */
  478. /*----------------------------------------------------------------------------*/
  479. DefineBuildOption:
  480.  
  481. BuildOption.vstring = Project.mode
  482. CALL VRadioBox BuildOption.title, BuildOption, OKCANCEL
  483. IF RETURN <> 'CANCEL' THEN DO
  484.   Project.status = 'CHANGED'
  485.   IF BuildOption.vstring = BuildOption.1 THEN
  486.     Project.mode = 'D'
  487.   ELSE
  488.     Project.mode = 'P'
  489. END
  490. RETURN
  491.  
  492. /*----------------------------------------------------------------------------*/
  493. /* DefineCompilerOptions: Define compiler options (global, debug, production) */
  494. /*----------------------------------------------------------------------------*/
  495. DefineCompilerOptions:
  496.  
  497. CompilerOptions.return.1 = Project.GlobalCompilerOptions
  498. CompilerOptions.return.2 = Project.DebugCompilerOptions
  499. CompilerOptions.return.3 = Project.ProductionCompilerOptions
  500.  
  501. CALL VMultBox CompilerOptions.title, CompilerOptions.prompt, CompilerOptions.width,,
  502.               CompilerOptions.hide, CompilerOptions.return, OKCANCEL
  503. IF RESULT <> 'CANCEL' THEN DO
  504.   Project.status                    = 'CHANGED'
  505.   Project.GlobalCompilerOptions     = CompilerOptions.return.1
  506.   Project.DebugCompilerOptions      = CompilerOptions.return.2
  507.   Project.ProductionCompilerOptions = CompilerOptions.return.3
  508. END
  509. RETURN
  510.  
  511. /*----------------------------------------------------------------------------*/
  512. /* DefineLinkOptions: flags and libs for the linker                           */
  513. /*----------------------------------------------------------------------------*/
  514. DefineLinkOptions:
  515.  
  516. LinkOptions.return.1 = Project.GlobalLinkOptions
  517. LinkOptions.return.2 = Project.DebugLinkOptions
  518. LinkOptions.return.3 = Project.ProductionLinkOptions
  519.  
  520. CALL VMultBox LinkOptions.title, LinkOptions.prompt, LinkOptions.width,,
  521.               LinkOptions.hide, LinkOptions.return, OKCANCEL
  522. IF RESULT <> 'CANCEL' THEN DO
  523.   Project.status                = 'CHANGED'
  524.   Project.GlobalLinkOptions     = LinkOptions.return.1
  525.   Project.DebugLinkOptions      = LinkOptions.return.2
  526.   Project.ProductionLinkOptions = LinkOptions.return.3
  527. END
  528. RETURN
  529.  
  530. /*----------------------------------------------------------------------------*/
  531. /* WriteProject: Generate the makefile                                        */
  532. /*----------------------------------------------------------------------------*/
  533. WriteProject:
  534.  
  535. IF Project.name = '.unnamed' THEN DO
  536.   CALL VMsgBox UnnamedProject.title, UnnamedProject, OK
  537.   RETURN 1
  538. END
  539.  
  540. d_objects.all = ''
  541. p_objects.all = ''
  542. DO i = 1 TO sources.0
  543.  
  544.   PARSE VALUE sources.i WITH objects.i '.' .
  545.   IF Project.environment = 'EMX' THEN DO
  546.     IF POS('-Zomf',Project.GlobalCompilerOptions,
  547.                                           Project.DebugCompilerOptions) > 0 THEN
  548.       d_objects.all = d_objects.all objects.i || '.obj'
  549.      ELSE
  550.       d_objects.all = d_objects.all objects.i || '.o'
  551.     IF POS('-Zomf',Project.GlobalCompilerOptions,
  552.                                      Project.ProductionCompilerOptions) > 0 THEN
  553.       p_objects.all = p_objects.all objects.i || '.obj'
  554.      ELSE
  555.       p_objects.all = p_objects.all objects.i || '.o'
  556.   END
  557.   ELSE DO
  558.     d_objects.all = d_objects.all objects.i || '.obj'
  559.     p_objects.all = p_objects.all objects.i || '.obj'
  560.   END
  561.  
  562.   dependents.i = sources.i
  563.   CALL SysFileSearch '#include', Project.dir||sources.i,'includes.'
  564.   DO j = 1 TO includes.0
  565.     IF SUBSTR(WORD(includes.j,2),1,1) = '"' THEN
  566.       dependents.i = dependents.i STRIP(WORD(includes.j,2),'B','"')
  567.   END
  568. END
  569.  
  570. IF SysFileDelete(Project.file) > 2 THEN DO
  571.   CALL VMsgBox DeleteFileProblem.title, DeleteFileProblem, OK
  572.   RETURN 1
  573. END
  574.  
  575. CALL LINEOUT Project.file, '# ============== Do not edit between these lines! ================'
  576. CALL LINEOUT Project.file, '# Makefile generated by EditProject Version' EditProject.version
  577. CALL LINEOUT Project.file, '# Project:' Project.project
  578. CALL LINEOUT Project.file, '# Date:   ' DATE()
  579. CALL LINEOUT Project.file, '# Time:   ' TIME()
  580. CALL LINEOUT Project.file, ' '
  581. CALL LINEOUT Project.file, 'CC =' EditProject.compiler
  582. CALL LINEOUT Project.file, 'MODE =' Project.mode
  583.  
  584. CALL LINEOUT Project.file, 'G_CFLAGS =' Project.GlobalCompilerOptions
  585. CALL LINEOUT Project.file, 'D_CFLAGS =' Project.DebugCompilerOptions
  586. CALL LINEOUT Project.file, 'P_CFLAGS =' Project.ProductionCompilerOptions
  587.  
  588. CALL LINEOUT Project.file, 'G_LFLAGS =' Project.GlobalLinkOptions
  589. CALL LINEOUT Project.file, 'D_LFLAGS =' Project.DebugLinkOptions
  590. CALL LINEOUT Project.file, 'P_LFLAGS =' Project.ProductionLinkOptions
  591.  
  592. CALL LINEOUT Project.file, 'PROJECT =' Project.project
  593. CALL LINEOUT Project.file, 'SOURCES =' sources.all
  594. CALL LINEOUT Project.file, 'D_OBJECTS =' d_objects.all
  595. CALL LINEOUT Project.file, 'P_OBJECTS =' p_objects.all
  596. CALL LINEOUT Project.file, 'VPATH   =' STRIP(TRANSLATE(Project.dir,'/','\'),'T','/')
  597. CALL LINEOUT Project.file, ' '
  598. CALL LINEOUT Project.file, '# ============== Do not edit between these lines! ================'
  599. CALL LINEOUT Project.file, ' '
  600. CALL LINEOUT Project.file, '$(PROJECT).EXE : $($(MODE)_OBJECTS)'
  601. CALL LINEOUT Project.file, D2C(9)'$(CC) $($(MODE)_OBJECTS) $(G_LFLAGS) $($(MODE)_LFLAGS) \'
  602. CALL LINEOUT Project.file, '                                    -o $(PROJECT).EXE'
  603. CALL LINEOUT Project.file, ' '
  604. CALL LINEOUT Project.file, '%.o : %.c'
  605. CALL LINEOUT Project.file, D2C(9)'$(CC) $(G_CFLAGS) $($(MODE)_CFLAGS) -c $< -o $@'
  606. CALL LINEOUT Project.file, ' '
  607. CALL LINEOUT Project.file, '%.obj : %.c'
  608. CALL LINEOUT Project.file, D2C(9)'$(CC) $(G_CFLAGS) $($(MODE)_CFLAGS) -c $< -o $@'
  609. CALL LINEOUT Project.file, ' '
  610. CALL LINEOUT Project.file, '%.o : %.cc'
  611. CALL LINEOUT Project.file, D2C(9)'$(CC) $(G_CFLAGS) $($(MODE)_CFLAGS) -c $< -o $@'
  612. CALL LINEOUT Project.file, ' '
  613. CALL LINEOUT Project.file, '%.obj : %.cc'
  614. CALL LINEOUT Project.file, D2C(9)'$(CC) $(G_CFLAGS) $($(MODE)_CFLAGS) -c $< -o $@'
  615. CALL LINEOUT Project.file, ' '
  616.  
  617. DO i=1 TO sources.0
  618.   CALL LINEOUT Project.file, ' '
  619.   CALL LINEOUT Project.file, WORD(d_objects.all,i) ':' dependents.i
  620.   IF d_objects.all <> p_objects.all THEN DO
  621.     CALL LINEOUT Project.file, ' '
  622.     CALL LINEOUT Project.file, WORD(p_objects.all,i) ':' dependents.i
  623.   END
  624. END
  625. CALL LINEOUT Project.file
  626.  
  627. Project.status = 'SAVED'
  628. RETURN 0
  629.  
  630. /*----------------------------------------------------------------------------*/
  631. /* ExecuteMakeFile: Run MAKE with current build option                        */
  632. /*----------------------------------------------------------------------------*/
  633. ExecuteMakeFile:
  634.  
  635. IF project.status = 'CHANGED' THEN DO
  636.   CALL VMsgBox SaveProject.title, SaveProject, YESNO
  637.   IF RESULT = 'YES' THEN DO
  638.     CALL WriteProject
  639.     IF RESULT > 0 THEN
  640.       RETURN
  641.   END
  642. END
  643.  
  644. "START /c /win" EditProject.make,
  645.       "-k -f" TRANSLATE(Project.file,'/','\') "MODE="Project.mode
  646. RETURN
  647.