* device/lib/pic16/**: build pic16 library using autotools for
[fw/sdcc] / support / scripts / sdcc.nsi
1 # sdcc.nsi - NSIS installer script for SDCC
2 #
3 # Copyright (c) 2003-2008 Borut Razem
4 #
5 # This file is part of sdcc.
6 #
7 #  This software is provided 'as-is', without any express or implied
8 #  warranty.  In no event will the authors be held liable for any damages
9 #  arising from the use of this software.
10 #
11 #  Permission is granted to anyone to use this software for any purpose,
12 #  including commercial applications, and to alter it and redistribute it
13 #  freely, subject to the following restrictions:
14 #
15 #  1. The origin of this software must not be misrepresented; you must not
16 #     claim that you wrote the original software. If you use this software
17 #     in a product, an acknowledgment in the product documentation would be
18 #     appreciated but is not required.
19 #  2. Altered source versions must be plainly marked as such, and must not be
20 #     misrepresented as being the original software.
21 #  3. This notice may not be removed or altered from any source distribution.
22 #
23 #  Borut Razem
24 #  borut.razem@siol.net
25
26 # How to create WIN32 setup.exe
27 #
28 # - unpack WIN32 mingw daily snapshot sdcc-snapshot-i586-mingw32msvc-yyyymmdd-rrrr.zip
29 #   to a clean directory (the option to create directories should be enabled).
30 #   A sub directory sdcc is created (referenced as PKGDIR in continuation).
31 # - copy files sdcc/support/scripts/sdcc.ico and sdcc/support/scripts/sdcc.nsi
32 #   (this file) from the sdcc Subversion snapshot to the PKGDIR directory
33 # - copy file COPYING from the sdcc Subversion snapshot to the PKGDIR directory,
34 #   rename it to COPYING.txt and convert it to DOS format:
35 #   unix2dos COPYING.txt
36 # - copy readline5.dll to PKGDIR/bin/readline5.dll
37 # - run NSIS installer from PKGDIR directory:
38 #   "c:\Program Files\NSIS\makensis.exe" -DVER_MAJOR=<SDCC_VER_MAJOR> -DVER_MINOR=<SDCC_VER_MINOR> -DVER_REVISION=<SDCC_VER_DEVEL> -DVER_BUILD=<SDCC_REVISION> sdcc.nsi
39 #   replace <VER_XXX> with the appropriate values, for example for SDCC 2.7.4:
40 #   <SDCC_VER_MAJOR> = 2
41 #   <SDCC_VER_MINOR> = 7
42 #   <SDCC_VER_DEVEL> = 4
43 #   replace <SDCC_REVISION> with the current svn revision number
44 # - A setup file setup.exe is created in PKGDIR directory.
45 #   Rename it to sdcc-yyyymmdd-rrrr-setup.exe and upload it
46 #   to sdcc download repository at sourceforge.net
47 #
48 #
49 # How to create WIN32 release setup.exe package
50 #
51 # - unpack WIN32 mingw daily snapshot sdcc-snapshot-i586-mingw32msvc-yyyymmdd-rrrr.zip
52 #   to a clean directory (the option to create directories should be enabled).
53 #   A sub directory sdcc is created (referenced as PKGDIR in continuation).
54 # - remove the PKGDIR/doc/ directory
55 # - unpack sdcc-doc-yyyymmdd-rrrr.zip to the PKGDIR/doc directory
56 # - copy files sdcc/support/scripts/sdcc.ico and sdcc/support/scripts/sdcc.nsi
57 #   (this file) from the sdcc Subversion snapshot to the PKGDIR directory
58 # - copy file COPYING from the sdcc Subversion snapshot to the PKGDIR directory,
59 #   rename it to COPYING.txt and convert it to DOS format:
60 #   unix2dos COPYING.txt
61 # - copy readline5.dll to PKGDIR/bin/readline5.dll
62 # - run NSIS installer from PKGDIR directory:
63 #   "c:\Program Files\NSIS\makensis.exe" -DFULL_DOC -DVER_MAJOR=<VER_MAJOR> -DVER_MINOR=<VER_MINOR> -DVER_REVISION=<VER_PATCH> -DVER_BUILD=<REVISION> sdcc.nsi
64 # - A setup file setup.exe is created in PKGDIR directory.
65 #   Rename it to sdcc-x.x.x-setup.exe and upload it
66 #   to sdcc download repository at sourceforge.net
67 #
68 # How to upload secc setup.exe tosourceforge.net
69 #
70 # Execute following commands from the cmd prompt:
71 # - sftp sdcc.sourceforge.net
72 # - cd /home/groups/s/sd/sdcc/htdocs/snapshots/i586-mingw32msvc-setup
73 # - put sdcc_yyyymmdd_setup.exe
74 # - quit
75 #
76 # For debugging define -DSDCC.DEBUG command line option
77
78 ;--------------------------------
79 ; Debugging Macros
80
81 !ifdef SDCC.DEBUG
82   Var SDCC.FunctionName
83   Var SDCC.StrStack0
84   Var SDCC.StrStack1
85   Var SDCC.StrStack2
86   Var SDCC.StrStack3
87   Var SDCC.StrStack4
88
89 !define SDCC.PushStr "!insertmacro MACRO_SDCC_PushStr"
90 !macro MACRO_SDCC_PushStr NAME
91   StrCpy $SDCC.StrStack4 $SDCC.StrStack3
92   StrCpy $SDCC.StrStack3 $SDCC.StrStack2
93   StrCpy $SDCC.StrStack2 $SDCC.StrStack1
94   StrCpy $SDCC.StrStack1 $SDCC.StrStack0
95   StrCpy $SDCC.StrStack0 $SDCC.FunctionName
96   StrCpy $SDCC.FunctionName "${NAME}"
97 !macroend
98
99 !define SDCC.PopStr "!insertmacro MACRO_SDCC_PopStr"
100 !macro MACRO_SDCC_PopStr
101   StrCpy $SDCC.FunctionName $SDCC.StrStack0
102   StrCpy $SDCC.StrStack0 $SDCC.StrStack1
103   StrCpy $SDCC.StrStack1 $SDCC.StrStack2
104   StrCpy $SDCC.StrStack2 $SDCC.StrStack3
105   StrCpy $SDCC.StrStack3 $SDCC.StrStack4
106 !macroend
107 !endif
108
109 !define DebugMsg "!insertmacro MACRO_SDCC_DebugMsg"
110 !macro MACRO_SDCC_DebugMsg MSG
111   !ifdef SDCC.DEBUG
112     MessageBox MB_OK "*** $SDCC.FunctionName: ${MSG} ***"
113   !endif
114 !macroend
115
116 !define Function "!insertmacro MACRO_SDCC_Function"
117 !macro MACRO_SDCC_Function NAME
118   Function "${NAME}"
119   !ifdef SDCC.DEBUG
120     ${SDCC.PushStr} ${NAME}
121   !endif
122 !macroend
123
124 !define FunctionEnd "!insertmacro MACRO_SDCC_FunctionEnd"
125 !macro MACRO_SDCC_FunctionEnd
126   !ifdef SDCC.DEBUG
127     ${SDCC.PopStr}
128   !endif
129   FunctionEnd
130 !macroend
131
132 !define Section "!insertmacro MACRO_SDCC_Section"
133 !macro MACRO_SDCC_Section NAME ID
134   Section "${NAME}" "${ID}"
135   !ifdef SDCC.DEBUG
136     ${SDCC.PushStr} "${NAME}"
137   !endif
138 !macroend
139
140 !define UnselectedSection "!insertmacro MACRO_SDCC_UnselectedSection"
141 !macro MACRO_SDCC_UnselectedSection NAME ID
142   Section /o ${NAME} ${ID}
143   !ifdef SDCC.DEBUG
144     ${SDCC.PushStr} "${NAME}"
145   !endif
146 !macroend
147
148 !define SectionEnd "!insertmacro MACRO_SDCC_SectionEnd"
149 !macro MACRO_SDCC_SectionEnd
150   !ifdef SDCC.DEBUG
151     ${SDCC.PopStr}
152   !endif
153   SectionEnd
154 !macroend
155
156
157 !define PRODUCT_NAME "SDCC"
158
159 ; Version
160 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
161   !define PRODUCT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}"
162 !else
163   !define PRODUCT_VERSION "XX.XX"
164 !endif
165
166 SetCompressor /SOLID lzma
167
168 !define SDCC_ROOT "."
169
170 !define DEV_ROOT "${SDCC_ROOT}"
171
172 !ifdef FULL_DOC
173 !system "unix2dos ${SDCC_ROOT}\doc\ChangeLog.txt" = 0
174 !else
175 !system "unix2dos ${SDCC_ROOT}\doc\ChangeLog_head.txt" = 0
176 !endif
177 !system "unix2dos ${SDCC_ROOT}\doc\README.TXT" = 0
178
179 InstType "Full (Bin, ucSim, SDCDB, Doc, Lib, Src)"
180 InstType "Medium (Bin, ucSim, SDCDB, Doc, Lib)"
181 InstType "Compact (Bin, ucSim, SDCDB, Doc)"
182
183 ;--------------------------------
184 ; Configuration
185
186 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
187 !define UNINST_ROOT_KEY HKLM
188 !define SDCC_ROOT_KEY HKLM
189
190 ;--------------------------------
191 ; Header Files
192
193 !include MUI2.nsh
194 !include WordFunc.nsh
195 !include StrFunc.nsh
196 ${StrStr}
197 ${UnStrStr}
198
199 ;--------------------------------
200 ; Functions
201
202 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
203   !insertmacro VersionCompare
204 !endif
205
206 ;--------------------------------
207 ; Variables
208
209 Var SDCC.PathToRemove
210
211 ;--------------------------------
212 ; Configuration
213
214 ; MUI Settings
215 !define MUI_ABORTWARNING
216 !define MUI_ICON ".\sdcc.ico"
217
218 ; Welcome page
219 !insertmacro MUI_PAGE_WELCOME
220
221 ; License page
222 !insertmacro MUI_PAGE_LICENSE "${SDCC_ROOT}\COPYING.txt"
223
224 ; Uninstall/reinstall page
225 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
226 Page custom SDCC.PageReinstall SDCC.PageLeaveReinstall
227 !endif
228
229 ; StartMenu page
230 !define MUI_STARTMENUPAGE_DEFAULTFOLDER ${PRODUCT_NAME}
231 !define MUI_STARTMENUPAGE_REGISTRY_ROOT ${UNINST_ROOT_KEY}
232 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
233 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "NSIS:StartMenuDir"
234 !define MUI_STARTMENUPAGE_NODISABLE
235 Var MUI_STARTMENUPAGE_VARIABLE
236 !insertmacro MUI_PAGE_STARTMENU Application $MUI_STARTMENUPAGE_VARIABLE
237
238 ; Components page
239 !define MUI_COMPONENTSPAGE_SMALLDESC
240 !insertmacro MUI_PAGE_COMPONENTS
241
242 ; Directory page
243 !insertmacro MUI_PAGE_DIRECTORY
244
245 ; Instfiles page
246 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE "SDCC.InstFilesLeave"
247 !insertmacro MUI_PAGE_INSTFILES
248
249 ${Function} SDCC.InstFilesLeave
250   ; Remove old path if reinstallation
251   ${If} $SDCC.PathToRemove != ""
252     ${DebugMsg} "removing path $SDCC.PathToRemove"
253     Push $SDCC.PathToRemove
254     Call SDCC.RemoveFromPath
255   ${EndIf}
256 ${FunctionEnd}
257
258 ; Finish page - add to path
259 !define MUI_FINISHPAGE_TEXT "Confirm the checkbox if you want to add SDCC binary directory to the PATH environment variable"
260 !define MUI_FINISHPAGE_SHOWREADME_TEXT "Add $INSTDIR\bin to the PATH"
261 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION SDCC.AddBinToPath
262 !define MUI_FINISHPAGE_SHOWREADME
263 !define MUI_FINISHPAGE_BUTTON "Next"
264 !insertmacro MUI_PAGE_FINISH
265
266 ; Finish page - reboot
267 !insertmacro MUI_PAGE_FINISH
268
269 ${Function} SDCC.AddBinToPath
270   ; Add new path
271   ${DebugMsg} "adding path $INSTDIR\bin"
272   Push "$INSTDIR\bin"
273   Call SDCC.AddToPath
274 ${FunctionEnd}
275
276 ; Uninstaller pages
277 !insertmacro MUI_UNPAGE_CONFIRM
278 !insertmacro MUI_UNPAGE_INSTFILES
279 !insertmacro MUI_UNPAGE_FINISH
280
281 ; Language files
282 !insertmacro MUI_LANGUAGE "English"
283
284 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
285 BrandingText ""
286 OutFile "setup.exe"
287 InstallDir "$PROGRAMFILES\SDCC"
288 ;;;;ShowInstDetails show
289 ;;;;ShowUnInstDetails show
290
291
292 ${Function} .onInit
293   ${DebugMsg} "Pre INSTDIR = $INSTDIR"
294
295 !ifndef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
296   ; Old unistallation method
297   ; Uninstall the old version, if present
298   ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
299   StrCmp $R0 "" inst
300
301   MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
302   "$(^Name) is already installed. $\n$\nClick 'OK' to remove the \
303   previous version or 'Cancel' to cancel this upgrade." \
304   IDOK uninst
305   Abort
306
307 uninst:
308   ; Run the uninstaller
309   ClearErrors
310   ExecWait '$R0'
311
312   Goto done
313 inst:
314
315   ; Install the new version
316   MessageBox MB_YESNO|MB_ICONQUESTION "This will install $(^Name). Do you wish to continue?" IDYES +2
317   Abort
318
319 done:
320 !else
321   ; If the registry key exists it is an uninstallation or reinstallation:
322   ;  take the old installation directory
323   Push $R0
324
325   ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation"
326   ${IfNot} ${Errors}
327     StrCpy $INSTDIR $R0
328     StrCpy $SDCC.PathToRemove "$INSTDIR\bin"
329   ${EndIf}
330
331   Pop $R0
332 !endif
333   ${DebugMsg} "Post INSTDIR = $INSTDIR"
334 ${FunctionEnd}
335
336 ${Function} un.onInit
337
338   ${DebugMsg} "Pre INSTDIR = $INSTDIR"
339
340   Push $R0
341   ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation"
342   ${IfNot} ${Errors}
343     StrCpy $INSTDIR $R0
344   ${EndIf}
345   Pop $R0
346
347   ${DebugMsg} "Post INSTDIR = $INSTDIR"
348
349 ${FunctionEnd}
350
351 ${Section} -Common SECCOMMON
352   SetOutPath "$INSTDIR"
353   File ".\sdcc.ico"
354   File "${SDCC_ROOT}\COPYING.txt"
355 ${SectionEnd}
356
357 ${Section} "SDCC application files" SEC01
358   SectionIn 1 2 3 RO
359   SetOutPath "$INSTDIR\bin"
360   File "${SDCC_ROOT}\bin\as-gbz80.exe"
361   File "${SDCC_ROOT}\bin\as-hc08.exe"
362   File "${SDCC_ROOT}\bin\as-z80.exe"
363   File "${SDCC_ROOT}\bin\asx8051.exe"
364   File "${SDCC_ROOT}\bin\aslink.exe"
365   File "${SDCC_ROOT}\bin\link-gbz80.exe"
366   File "${SDCC_ROOT}\bin\link-hc08.exe"
367   File "${SDCC_ROOT}\bin\link-z80.exe"
368   File "${SDCC_ROOT}\bin\makebin.exe"
369   File "${SDCC_ROOT}\bin\packihx.exe"
370   File "${SDCC_ROOT}\bin\sdcc.exe"
371   File "${SDCC_ROOT}\bin\sdcclib.exe"
372   File "${SDCC_ROOT}\bin\sdcpp.exe"
373   File "${SDCC_ROOT}\bin\readline5.dll"
374 ${SectionEnd}
375
376 ${Section} "ucSim application files" SEC02
377   SectionIn 1 2 3
378   SetOutPath "$INSTDIR\bin"
379   File "${SDCC_ROOT}\bin\s51.exe"
380   File "${SDCC_ROOT}\bin\savr.exe"
381   File "${SDCC_ROOT}\bin\shc08.exe"
382   File "${SDCC_ROOT}\bin\sz80.exe"
383 ${SectionEnd}
384
385 ${Section} "SDCDB files" SEC03
386   SectionIn 1 2 3
387   File "${SDCC_ROOT}\bin\sdcdb.exe"
388   File "${SDCC_ROOT}\bin\sdcdb.el"
389   File "${SDCC_ROOT}\bin\sdcdbsrc.el"
390 ${SectionEnd}
391
392 ${Section} "SDCC documentation" SEC04
393   SectionIn 1 2 3
394   SetOutPath "$INSTDIR\doc"
395 !ifdef FULL_DOC
396   File /r "${SDCC_ROOT}\doc\*"
397 !else
398   File "${SDCC_ROOT}\doc\ChangeLog_head.txt"
399   File "${SDCC_ROOT}\doc\README.TXT"
400 !endif
401 ${SectionEnd}
402
403 ${Section} "SDCC include files" SEC05
404   SectionIn 1 2
405   SetOutPath "$INSTDIR\include\asm\default"
406   File "${DEV_ROOT}\include\asm\default\features.h"
407   SetOutPath "$INSTDIR\include\asm\ds390"
408   File "${DEV_ROOT}\include\asm\ds390\features.h"
409   SetOutPath "$INSTDIR\include\asm\gbz80"
410   File "${DEV_ROOT}\include\asm\gbz80\features.h"
411   SetOutPath "$INSTDIR\include\asm\mcs51"
412   File "${DEV_ROOT}\include\asm\mcs51\features.h"
413   SetOutPath "$INSTDIR\include\asm\pic"
414   File "${DEV_ROOT}\include\asm\pic\features.h"
415   SetOutPath "$INSTDIR\include\asm\pic16"
416   File "${DEV_ROOT}\include\asm\pic16\features.h"
417   SetOutPath "$INSTDIR\include\asm\z80"
418   File "${DEV_ROOT}\include\asm\z80\features.h"
419   SetOutPath "$INSTDIR\include\hc08"
420   File "${DEV_ROOT}\include\hc08\*.h"
421   SetOutPath "$INSTDIR\include\mcs51"
422   File "${DEV_ROOT}\include\mcs51\*.h"
423   SetOutPath "$INSTDIR\include\pic"
424   File "${DEV_ROOT}\include\pic\*.h"
425   File "${DEV_ROOT}\include\pic\*.txt"
426   File "${DEV_ROOT}\include\pic\*.inc"
427   SetOutPath "$INSTDIR\include\pic16"
428   File "${DEV_ROOT}\include\pic16\*.h"
429   File "${DEV_ROOT}\include\pic16\*.txt"
430   SetOutPath "$INSTDIR\include\z80"
431   File "${DEV_ROOT}\include\z80\*.h"
432   SetOutPath "$INSTDIR\include"
433   File "${DEV_ROOT}\include\*.h"
434 ${SectionEnd}
435
436 ${Section} "SDCC DS390 library" SEC06
437   SectionIn 1 2
438   SetOutPath "$INSTDIR\lib\ds390"
439   File "${DEV_ROOT}\lib\ds390\*.rel"
440   File "${DEV_ROOT}\lib\ds390\*.lib"
441 ${SectionEnd}
442
443 ${Section} "SDCC DS400 library" SEC07
444   SectionIn 1 2
445   SetOutPath "$INSTDIR\lib\ds400"
446   File "${DEV_ROOT}\lib\ds400\*.rel"
447   File "${DEV_ROOT}\lib\ds400\*.lib"
448 ${SectionEnd}
449
450 ${Section} "SDCC GBZ80 library" SEC08
451   SectionIn 1 2
452   SetOutPath "$INSTDIR\lib\gbz80"
453   File "${DEV_ROOT}\lib\gbz80\*.o"
454   File "${DEV_ROOT}\lib\gbz80\*.lib"
455 ${SectionEnd}
456
457 ${Section} "SDCC Z80 library" SEC09
458   SectionIn 1 2
459   SetOutPath "$INSTDIR\lib\z80"
460   File "${DEV_ROOT}\lib\z80\*.o"
461   File "${DEV_ROOT}\lib\z80\*.lib"
462 ${SectionEnd}
463
464 ${Section} "SDCC small model library" SEC10
465   SectionIn 1 2
466   SetOutPath "$INSTDIR\lib\small"
467   File "${DEV_ROOT}\lib\small\*.rel"
468   File "${DEV_ROOT}\lib\small\*.lib"
469 ${SectionEnd}
470
471 ${Section} "SDCC medium model library" SEC11
472   SectionIn 1 2
473   SetOutPath "$INSTDIR\lib\medium"
474   File "${DEV_ROOT}\lib\medium\*.rel"
475   File "${DEV_ROOT}\lib\medium\*.lib"
476 ${SectionEnd}
477
478 ${Section} "SDCC large model library" SEC12
479   SectionIn 1 2
480   SetOutPath "$INSTDIR\lib\large"
481   File "${DEV_ROOT}\lib\large\*.rel"
482   File "${DEV_ROOT}\lib\large\*.lib"
483 ${SectionEnd}
484
485 ${Section} "SDCC small-stack-auto model library" SEC13
486   SectionIn 1 2
487   SetOutPath "$INSTDIR\lib\small-stack-auto"
488   File "${DEV_ROOT}\lib\small-stack-auto\*.rel"
489   File "${DEV_ROOT}\lib\small-stack-auto\*.lib"
490 ${SectionEnd}
491
492 ${Section} "SDCC HC08 library" SEC14
493   SectionIn 1 2
494   SetOutPath "$INSTDIR\lib\hc08"
495   File "${DEV_ROOT}\lib\hc08\*.rel"
496   File "${DEV_ROOT}\lib\hc08\*.lib"
497 ${SectionEnd}
498
499 ${Section} "SDCC PIC16 library" SEC15
500   SectionIn 1 2
501   SetOutPath "$INSTDIR\lib\pic16"
502   File "${DEV_ROOT}\lib\pic16\*.o"
503   File "${DEV_ROOT}\lib\pic16\*.a"
504 ${SectionEnd}
505
506 ${Section} "SDCC PIC library" SEC16
507   SectionIn 1 2
508   SetOutPath "$INSTDIR\lib\pic"
509   File "${DEV_ROOT}\lib\pic\*.lib"
510 ${SectionEnd}
511
512 ${Section} "SDCC library sources" SEC17
513   SectionIn 1
514   SetOutPath "$INSTDIR\lib\src\ds390\examples"
515   File "${DEV_ROOT}\lib\src\ds390\examples\MOVED"
516
517   SetOutPath "$INSTDIR\lib\src\ds390"
518   File "${DEV_ROOT}\lib\src\ds390\*.c"
519 #  File "${DEV_ROOT}\lib\src\ds390\Makefile"
520
521   SetOutPath "$INSTDIR\lib\src\ds400"
522   File "${DEV_ROOT}\lib\src\ds400\*.c"
523 #  File "${DEV_ROOT}\lib\src\ds400\Makefile"
524
525   SetOutPath "$INSTDIR\lib\src\gbz80"
526   File "${DEV_ROOT}\lib\src\gbz80\*.c"
527   File "${DEV_ROOT}\lib\src\gbz80\*.s"
528 #  File "${DEV_ROOT}\lib\src\gbz80\Makefile"
529
530   SetOutPath "$INSTDIR\lib\src\z80"
531   File "${DEV_ROOT}\lib\src\z80\*.c"
532   File "${DEV_ROOT}\lib\src\z80\*.s"
533 #  File "${DEV_ROOT}\lib\src\z80\Makefile"
534
535   SetOutPath "$INSTDIR\lib\src\hc08"
536   File "${DEV_ROOT}\lib\src\hc08\*.c"
537 #  File "${DEV_ROOT}\lib\src\hc08\Makefile"
538
539   SetOutPath "$INSTDIR\lib\src\mcs51"
540   File "${DEV_ROOT}\lib\src\mcs51\*.asm"
541 #  File "${DEV_ROOT}\lib\src\mcs51\Makefile"
542
543   SetOutPath "$INSTDIR\lib\src\small"
544 #  File "${DEV_ROOT}\lib\src\small\Makefile"
545
546   SetOutPath "$INSTDIR\lib\src\medium"
547 #  File "${DEV_ROOT}\lib\src\medium\Makefile"
548
549   SetOutPath "$INSTDIR\lib\src\large"
550 #  File "${DEV_ROOT}\lib\src\large\Makefile"
551
552   SetOutPath "$INSTDIR\lib\src\pic"
553 #  File "${DEV_ROOT}\lib\src\pic\configure"
554 #  File "${DEV_ROOT}\lib\src\pic\configure.in"
555 #  File "${DEV_ROOT}\lib\src\pic\GPL"
556 #  File "${DEV_ROOT}\lib\src\pic\LGPL"
557 #  File "${DEV_ROOT}\lib\src\pic\Makefile"
558 #  File "${DEV_ROOT}\lib\src\pic\Makefile.common"
559 #  File "${DEV_ROOT}\lib\src\pic\Makefile.common.in"
560 #  File "${DEV_ROOT}\lib\src\pic\Makefile.rules"
561 #  File "${DEV_ROOT}\lib\src\pic\Makefile.subdir"
562 #  File "${DEV_ROOT}\lib\src\pic\NEWS"
563 #  File "${DEV_ROOT}\lib\src\pic\README"
564   File "${DEV_ROOT}\lib\src\pic\TEMPLATE.c"
565   File "${DEV_ROOT}\lib\src\pic\TEMPLATE.S"
566
567   SetOutPath "$INSTDIR\lib\src\pic\libsdcc"
568   File "${DEV_ROOT}\lib\src\pic\libsdcc\*.c"
569   File "${DEV_ROOT}\lib\src\pic\libsdcc\*.S"
570   File "${DEV_ROOT}\lib\src\pic\libsdcc\*.inc"
571 #  File "${DEV_ROOT}\lib\src\pic\libsdcc\Makefile"
572   
573   SetOutPath "$INSTDIR\lib\src\pic\libdev"
574   File "${DEV_ROOT}\lib\src\pic\libdev\*.c"
575 #  File "${DEV_ROOT}\lib\src\pic\libdev\Makefile"
576
577   SetOutPath "$INSTDIR\lib\src\pic\libm"
578   File "${DEV_ROOT}\lib\src\pic\libm\*.c"
579
580   SetOutPath "$INSTDIR\lib\src\pic16"
581 #  File "${DEV_ROOT}\lib\src\pic16\configure"
582 #  File "${DEV_ROOT}\lib\src\pic16\configure.in"
583 #  File "${DEV_ROOT}\lib\src\pic16\COPYING"
584 #  File "${DEV_ROOT}\lib\src\pic16\Makefile"
585 #  File "${DEV_ROOT}\lib\src\pic16\Makefile.common"
586 #  File "${DEV_ROOT}\lib\src\pic16\Makefile.common.in"
587 #  File "${DEV_ROOT}\lib\src\pic16\Makefile.rules"
588 #  File "${DEV_ROOT}\lib\src\pic16\Makefile.subdir"
589 #  File "${DEV_ROOT}\lib\src\pic16\pics.all"
590 #  File "${DEV_ROOT}\lib\src\pic16\pics.build"
591 #  File "${DEV_ROOT}\lib\src\pic16\README"
592
593   SetOutPath "$INSTDIR\lib\src\pic16\debug"
594 #  File "${DEV_ROOT}\lib\src\pic16\debug\Makefile"
595
596   SetOutPath "$INSTDIR\lib\src\pic16\debug\gstack"
597 #  File "${DEV_ROOT}\lib\src\pic16\debug\gstack\Makefile"
598   File "${DEV_ROOT}\lib\src\pic16\debug\gstack\*.c"
599
600   SetOutPath "$INSTDIR\lib\src\pic16\libc"
601 #  File "${DEV_ROOT}\lib\src\pic16\libc\Makefile"
602
603   SetOutPath "$INSTDIR\lib\src\pic16\libc\ctype"
604   File "${DEV_ROOT}\lib\src\pic16\libc\ctype\*.c"
605 #  File "${DEV_ROOT}\lib\src\pic16\libc\ctype\Makefile"
606
607   SetOutPath "$INSTDIR\lib\src\pic16\libc\delay"
608   File "${DEV_ROOT}\lib\src\pic16\libc\delay\*.S"
609 #  File "${DEV_ROOT}\lib\src\pic16\libc\delay\Makefile"
610
611   SetOutPath "$INSTDIR\lib\src\pic16\libc\stdio"
612   File "${DEV_ROOT}\lib\src\pic16\libc\stdio\*.c"
613 #  File "${DEV_ROOT}\lib\src\pic16\libc\stdio\Makefile"
614
615   SetOutPath "$INSTDIR\lib\src\pic16\libc\stdlib"
616   File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\*.c"
617   File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\*.S"
618 #  File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\Makefile"
619
620   SetOutPath "$INSTDIR\lib\src\pic16\libc\string"
621   File "${DEV_ROOT}\lib\src\pic16\libc\string\*.c"
622 #  File "${DEV_ROOT}\lib\src\pic16\libc\string\Makefile"
623
624   SetOutPath "$INSTDIR\lib\src\pic16\libc\utils"
625   File "${DEV_ROOT}\lib\src\pic16\libc\utils\*.S"
626 #  File "${DEV_ROOT}\lib\src\pic16\libc\utils\Makefile"
627
628   SetOutPath "$INSTDIR\lib\src\pic16\libdev"
629   File "${DEV_ROOT}\lib\src\pic16\libdev\*.c"
630 #  File "${DEV_ROOT}\lib\src\pic16\libdev\Makefile"
631
632   SetOutPath "$INSTDIR\lib\src\pic16\libio"
633   File "${DEV_ROOT}\lib\src\pic16\libio\*.ignore"
634 #  File "${DEV_ROOT}\lib\src\pic16\libio\Makefile"
635
636   SetOutPath "$INSTDIR\lib\src\pic16\libio\adc"
637   File "${DEV_ROOT}\lib\src\pic16\libio\adc\*.c"
638 #  File "${DEV_ROOT}\lib\src\pic16\libio\adc\Makefile"
639
640   SetOutPath "$INSTDIR\lib\src\pic16\libio\i2c"
641   File "${DEV_ROOT}\lib\src\pic16\libio\i2c\*.c"
642 #  File "${DEV_ROOT}\lib\src\pic16\libio\i2c\Makefile"
643
644   SetOutPath "$INSTDIR\lib\src\pic16\libio\usart"
645   File "${DEV_ROOT}\lib\src\pic16\libio\usart\*.c"
646 #  File "${DEV_ROOT}\lib\src\pic16\libio\usart\Makefile"
647
648   SetOutPath "$INSTDIR\lib\src\pic16\libm"
649   File "${DEV_ROOT}\lib\src\pic16\libm\*.c"
650 #  File "${DEV_ROOT}\lib\src\pic16\libm\Makefile"
651
652   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc"
653 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\Makefile"
654
655   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\char"
656   File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\*.c"
657 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\Makefile"
658
659   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\fixed16x16"
660   File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\*.c"
661   File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\*.S"
662 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\Makefile"
663
664   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\float"
665   File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\*.c"
666 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\Makefile"
667
668   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\gptr"
669   File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\*.c"
670 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\Makefile"
671
672   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\int"
673   File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\*.c"
674 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\Makefile"
675
676   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\long"
677   File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\*.c"
678 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\Makefile"
679
680   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\lregs"
681   File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\*.c"
682 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\Makefile"
683
684   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\stack"
685   File "${DEV_ROOT}\lib\src\pic16\libsdcc\stack\*.S"
686
687   SetOutPath "$INSTDIR\lib\src\pic16\startup"
688   File "${DEV_ROOT}\lib\src\pic16\startup\*.c"
689 #  File "${DEV_ROOT}\lib\src\pic16\startup\Makefile"
690 #  File "${DEV_ROOT}\lib\src\pic16\startup\README"
691
692   SetOutPath "$INSTDIR\lib\src"
693   File "${DEV_ROOT}\lib\src\*.c"
694 ${SectionEnd}
695
696 ;--------------------------------
697 ;Descriptions
698
699 ;Language strings
700 LangString DESC_SEC01 ${LANG_ENGLISH} "SDCC application files"
701 LangString DESC_SEC02 ${LANG_ENGLISH} "ucSim application files"
702 LangString DESC_SEC03 ${LANG_ENGLISH} "SDCDB files"
703 LangString DESC_SEC04 ${LANG_ENGLISH} "SDCC documentation"
704 LangString DESC_SEC05 ${LANG_ENGLISH} "SDCC include files"
705 LangString DESC_SEC06 ${LANG_ENGLISH} "SDCC DS390 library"
706 LangString DESC_SEC07 ${LANG_ENGLISH} "SDCC DS400 library"
707 LangString DESC_SEC08 ${LANG_ENGLISH} "SDCC GBZ80 library"
708 LangString DESC_SEC09 ${LANG_ENGLISH} "SDCC Z80 library"
709 LangString DESC_SEC10 ${LANG_ENGLISH} "SDCC small model library"
710 LangString DESC_SEC11 ${LANG_ENGLISH} "SDCC medium model library"
711 LangString DESC_SEC12 ${LANG_ENGLISH} "SDCC large model library"
712 LangString DESC_SEC13 ${LANG_ENGLISH} "SDCC small-stack-auto model library"
713 LangString DESC_SEC14 ${LANG_ENGLISH} "SDCC HC08 library"
714 LangString DESC_SEC15 ${LANG_ENGLISH} "SDCC PIC16 library"
715 LangString DESC_SEC16 ${LANG_ENGLISH} "SDCC PIC library"
716 LangString DESC_SEC17 ${LANG_ENGLISH} "SDCC library sources"
717
718 ;Assign language strings to sections
719 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
720   !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(DESC_SEC01)
721   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(DESC_SEC02)
722   !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $(DESC_SEC03)
723   !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $(DESC_SEC04)
724   !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} $(DESC_SEC05)
725   !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} $(DESC_SEC06)
726   !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} $(DESC_SEC07)
727   !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} $(DESC_SEC08)
728   !insertmacro MUI_DESCRIPTION_TEXT ${SEC09} $(DESC_SEC09)
729   !insertmacro MUI_DESCRIPTION_TEXT ${SEC10} $(DESC_SEC10)
730   !insertmacro MUI_DESCRIPTION_TEXT ${SEC11} $(DESC_SEC11)
731   !insertmacro MUI_DESCRIPTION_TEXT ${SEC12} $(DESC_SEC12)
732   !insertmacro MUI_DESCRIPTION_TEXT ${SEC13} $(DESC_SEC13)
733   !insertmacro MUI_DESCRIPTION_TEXT ${SEC14} $(DESC_SEC14)
734   !insertmacro MUI_DESCRIPTION_TEXT ${SEC15} $(DESC_SEC15)
735   !insertmacro MUI_DESCRIPTION_TEXT ${SEC16} $(DESC_SEC16)
736   !insertmacro MUI_DESCRIPTION_TEXT ${SEC17} $(DESC_SEC17)
737 !insertmacro MUI_FUNCTION_DESCRIPTION_END
738 ;--------------------------------
739
740 ${Section} -Icons SECICONS
741 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
742   CreateDirectory "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
743   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk" "$INSTDIR\uninstall.exe" 
744 !ifdef FULL_DOC
745   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk" "$INSTDIR\doc\sdccman.pdf" "" "$INSTDIR\sdcc.ico" "" "" "" ""
746   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\README.lnk" "$INSTDIR\doc\README.TXT" "" "$INSTDIR\sdcc.ico" "" "" "" ""
747   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk" "$INSTDIR\doc\ChangeLog.txt" "" "$INSTDIR\sdcc.ico" "" "" "" ""
748 !else
749   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk" "$INSTDIR\doc\README.TXT" "" "$INSTDIR\sdcc.ico" "" "" "" ""
750   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk" "$INSTDIR\doc\ChangeLog_head.txt" "" "$INSTDIR\sdcc.ico" "" "" "" ""
751 !endif
752   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk" "$INSTDIR\COPYING.txt"
753 !insertmacro MUI_STARTMENU_WRITE_END
754 ${SectionEnd}
755
756 ${Section} -INI SECINI
757   WriteIniStr "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.url" "InternetShortcut" "URL" "http://sdcc.sourceforge.net/"
758 !ifdef FULL_DOC
759   WriteIniStr "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Latest Changes.url" "InternetShortcut" "URL" "http://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc/ChangeLog"
760 !endif
761 ${SectionEnd}
762
763 ${Section} -PostInstall SECPOSTINSTALL
764   WriteRegStr ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "" $INSTDIR
765 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
766   WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMajor" "${VER_MAJOR}"
767   WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMinor" "${VER_MINOR}"
768   WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionRevision" "${VER_REVISION}"
769   WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionBuild" "${VER_BUILD}"
770 !endif
771
772   WriteRegExpandStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstall.exe"
773   WriteRegExpandStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
774   WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}"
775   WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "sdcc.sourceforge.net"
776   WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "http://sdcc.sourceforge.net/"
777   WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "HelpLink" "http://sdcc.sourceforge.net/"
778   WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "http://sdcc.sourceforge.net/"
779
780   WriteUninstaller "$INSTDIR\uninstall.exe"
781 ${SectionEnd}
782
783
784 ;;;; Uninstaller code ;;;;
785
786 ${Section} Uninstall SECUNINSTALL
787   !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_STARTMENUPAGE_VARIABLE
788
789   ${DebugMsg} "removing path $INSTDIR\bin"
790   Push "$INSTDIR\bin"
791   Call un.SDCC.RemoveFromPath
792
793 ; Clean the registry
794   DeleteRegKey ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
795   DeleteRegKey ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}"
796
797   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk"
798   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk"
799 !ifdef FULL_DOC
800   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Latest Changes.url"
801   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\README.lnk"
802 !endif
803   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk"
804   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk"
805   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.url"
806
807   RMDir "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
808
809   Delete "$INSTDIR\lib\src\large\Makefile"
810
811   Delete "$INSTDIR\lib\src\medium\Makefile"
812
813   Delete "$INSTDIR\lib\src\small\Makefile"
814
815   Delete "$INSTDIR\lib\src\mcs51\*.asm"
816   Delete "$INSTDIR\lib\src\mcs51\Makefile"
817   Delete "$INSTDIR\lib\src\mcs51\README"
818
819   Delete "$INSTDIR\lib\src\hc08\*.c"
820   Delete "$INSTDIR\lib\src\hc08\hc08.lib"
821   Delete "$INSTDIR\lib\src\hc08\Makefile"
822
823   Delete "$INSTDIR\lib\src\z80\*.c"
824   Delete "$INSTDIR\lib\src\z80\*.s"
825   Delete "$INSTDIR\lib\src\z80\z80.lib"
826   Delete "$INSTDIR\lib\src\z80\README"
827   Delete "$INSTDIR\lib\src\z80\Makefile"
828
829   Delete "$INSTDIR\lib\src\gbz80\*.c"
830   Delete "$INSTDIR\lib\src\gbz80\*.s"
831   Delete "$INSTDIR\lib\src\gbz80\gbz80.lib"
832   Delete "$INSTDIR\lib\src\gbz80\README"
833   Delete "$INSTDIR\lib\src\gbz80\Makefile"
834
835   Delete "$INSTDIR\lib\src\ds390\*.c"
836   Delete "$INSTDIR\lib\src\ds390\libds390.lib"
837   Delete "$INSTDIR\lib\src\ds390\Makefile.dep"
838   Delete "$INSTDIR\lib\src\ds390\Makefile"
839   Delete "$INSTDIR\lib\src\ds390\examples\MOVED"
840
841   Delete "$INSTDIR\lib\src\ds400\*.c"
842   Delete "$INSTDIR\lib\src\ds400\libds400.lib"
843   Delete "$INSTDIR\lib\src\ds400\Makefile.dep"
844   Delete "$INSTDIR\lib\src\ds400\Makefile"
845
846   Delete "$INSTDIR\lib\src\*.c"
847
848   Delete "$INSTDIR\lib\pic\*.o"
849   Delete "$INSTDIR\lib\pic\*.lib"
850
851   Delete "$INSTDIR\lib\pic16\*.o"
852   Delete "$INSTDIR\lib\pic16\*.a"
853
854   Delete "$INSTDIR\lib\hc08\*.rel"
855   Delete "$INSTDIR\lib\hc08\*.lib"
856
857   Delete "$INSTDIR\lib\z80\*.o"
858   Delete "$INSTDIR\lib\z80\*.lib"
859
860   Delete "$INSTDIR\lib\small\*.rel"
861   Delete "$INSTDIR\lib\small\*.lib"
862
863   Delete "$INSTDIR\lib\medium\*.rel"
864   Delete "$INSTDIR\lib\medium\*.lib"
865
866   Delete "$INSTDIR\lib\large\*.rel"
867   Delete "$INSTDIR\lib\large\*.lib"
868
869   Delete "$INSTDIR\lib\small-stack-auto\*.rel"
870   Delete "$INSTDIR\lib\small-stack-auto\*.lib"
871
872   Delete "$INSTDIR\lib\gbz80\*.o"
873   Delete "$INSTDIR\lib\gbz80\*.lib"
874
875   Delete "$INSTDIR\lib\ds390\*.rel"
876   Delete "$INSTDIR\lib\ds390\*.lib"
877
878   Delete "$INSTDIR\lib\ds400\*.rel"
879   Delete "$INSTDIR\lib\ds400\*.lib"
880
881   Delete "$INSTDIR\include\asm\z80\*.h"
882   Delete "$INSTDIR\include\asm\pic16\*.h"
883   Delete "$INSTDIR\include\asm\pic\*.h"
884   Delete "$INSTDIR\include\asm\mcs51\*.h"
885   Delete "$INSTDIR\include\asm\gbz80\*.h"
886   Delete "$INSTDIR\include\asm\ds390\*.h"
887   Delete "$INSTDIR\include\asm\default\*.h"
888   Delete "$INSTDIR\include\z80\*.h"
889   Delete "$INSTDIR\include\pic\*.h"
890   Delete "$INSTDIR\include\pic\*.txt"
891   Delete "$INSTDIR\include\pic\*.inc"
892   Delete "$INSTDIR\include\pic16\*.h"
893   Delete "$INSTDIR\include\pic16\*.txt"
894   Delete "$INSTDIR\include\mcs51\*.h"
895   Delete "$INSTDIR\include\hc08\*.h"
896   Delete "$INSTDIR\include\*.h"
897
898 !ifndef FULL_DOC
899   Delete "$INSTDIR\doc\README.TXT"
900   Delete "$INSTDIR\doc\ChangeLog_head.txt"
901 !endif
902
903   Delete "$INSTDIR\bin\as-gbz80.exe"
904   Delete "$INSTDIR\bin\as-hc08.exe"
905   Delete "$INSTDIR\bin\as-z80.exe"
906   Delete "$INSTDIR\bin\asx8051.exe"
907   Delete "$INSTDIR\bin\aslink.exe"
908   Delete "$INSTDIR\bin\link-gbz80.exe"
909   Delete "$INSTDIR\bin\link-hc08.exe"
910   Delete "$INSTDIR\bin\link-z80.exe"
911   Delete "$INSTDIR\bin\makebin.exe"
912   Delete "$INSTDIR\bin\packihx.exe"
913   Delete "$INSTDIR\bin\sdcc.exe"
914   Delete "$INSTDIR\bin\sdcclib.exe"
915   Delete "$INSTDIR\bin\sdcpp.exe"
916   Delete "$INSTDIR\bin\readline5.dll"
917
918
919   Delete "$INSTDIR\bin\s51.exe"
920   Delete "$INSTDIR\bin\savr.exe"
921   Delete "$INSTDIR\bin\shc08.exe"
922   Delete "$INSTDIR\bin\sz80.exe"
923
924   Delete "$INSTDIR\bin\sdcdb.exe"
925   Delete "$INSTDIR\bin\sdcdb.el"
926   Delete "$INSTDIR\bin\sdcdbsrc.el"
927
928   Delete "$INSTDIR\COPYING.txt"
929   Delete "$INSTDIR\sdcc.ico"
930   Delete "$INSTDIR\uninstall.exe"
931
932   RMDir /r "$INSTDIR\lib\src\pic"
933   RMDir /r "$INSTDIR\lib\src\pic16"
934   RMDir "$INSTDIR\lib\src\small"
935   RMDir "$INSTDIR\lib\src\medium"
936   RMDir "$INSTDIR\lib\src\large"
937   RMDir "$INSTDIR\lib\src\mcs51"
938   RMDir "$INSTDIR\lib\src\z80"
939   RMDir "$INSTDIR\lib\src\gbz80"
940   RMDir "$INSTDIR\lib\src\ds390\examples"
941   RMDir "$INSTDIR\lib\src\ds390"
942   RMDir "$INSTDIR\lib\src\ds400"
943   RMDir "$INSTDIR\lib\src\hc08"
944   RMDir "$INSTDIR\lib\src"
945
946   RMDir "$INSTDIR\lib\pic"
947   RMDir "$INSTDIR\lib\pic16"
948   RMDir "$INSTDIR\lib\z80"
949   RMDir "$INSTDIR\lib\small"
950   RMDir "$INSTDIR\lib\medium"
951   RMDir "$INSTDIR\lib\large"
952   RMDir "$INSTDIR\lib\small-stack-auto"
953   RMDir "$INSTDIR\lib\gbz80"
954   RMDir "$INSTDIR\lib\ds390"
955   RMDir "$INSTDIR\lib\ds400"
956   RMDir "$INSTDIR\lib\hc08"
957   RMDir "$INSTDIR\lib"
958
959   RMDir "$INSTDIR\include\asm\z80"
960   RMDir "$INSTDIR\include\asm\pic16"
961   RMDir "$INSTDIR\include\asm\pic"
962   RMDir "$INSTDIR\include\asm\mcs51"
963   RMDir "$INSTDIR\include\asm\gbz80"
964   RMDir "$INSTDIR\include\asm\ds390"
965   RMDir "$INSTDIR\include\asm\default"
966   RMDir "$INSTDIR\include\asm"
967   RMDir "$INSTDIR\include\z80"
968   RMDir "$INSTDIR\include\pic"
969   RMDir "$INSTDIR\include\pic16"
970   RMDir "$INSTDIR\include\mcs51"
971   RMDir "$INSTDIR\include\hc08"
972   RMDir "$INSTDIR\include"
973
974 !ifdef FULL_DOC
975   RMDir /r "$INSTDIR\doc"
976 !else
977   RMDir "$INSTDIR\doc"
978 !endif
979
980   RMDir "$INSTDIR\bin"
981
982   RMDir "$INSTDIR"
983 ;;;;  SetAutoClose true
984 ${SectionEnd}
985
986 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
987 ; Path Manipulation functions                                                 ;
988 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
989
990 !verbose 3
991 !include "WinMessages.nsh"
992 !verbose 4
993
994 ; AddToPath - Adds the given dir to the search path.
995 ;        Input - head of the stack
996 ;        Note - Win9x systems requires reboot
997
998 ${Function} SDCC.AddToPath
999   Exch $0
1000   Push $1
1001   Push $2
1002   Push $3
1003   Push $4
1004
1005   ; don't add if the path doesn't exist
1006   ${If} ${FileExists} $0
1007     Call SDCC.IsNT
1008     Pop $4
1009     ${If} $4 != 1
1010       ; Not on NT: read PATH from environment variable
1011       ReadEnvStr $1 PATH
1012     ${Else}
1013       ; On NT: read PATH from registry
1014       ReadRegStr $1 HKCU "Environment" "PATH"
1015     ${EndIf}
1016
1017     ${StrStr} $2 "$1;" "$0;"
1018     ${If} $2 == ""
1019       ${StrStr} $2 "$1;" "$0\;"
1020       ${If} $2 == ""
1021         GetFullPathName /SHORT $3 $0
1022         ${StrStr} $2 "$1;" "$3;"
1023         ${If} $2 == ""
1024           ${StrStr} $2 "$1;" "$03\;"
1025           ${If} $2 == ""
1026             ${If} $4 != 1
1027               ; Not on NT
1028               StrCpy $1 $WINDIR 2
1029               FileOpen $1 "$1\autoexec.bat" a
1030               FileSeek $1 -1 END
1031               FileReadByte $1 $2
1032               ${If} $2 = 26        ; DOS EOF
1033                 FileSeek $1 -1 END ; write over EOF
1034               ${Endif}
1035               ${DebugMsg} "adding line $\r$\nSET PATH=%PATH%;$3$\r$\n"
1036               FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
1037               FileClose $1
1038               ${DebugMsg} "SetRebootFlag true"
1039               SetRebootFlag true
1040             ${Else}
1041               ;System PATH variable is at:
1042               ;HKLM "/SYSTEM/CurrentControlSet/Control/Session Manager/Environment" "Path"
1043               ReadRegStr $1 HKCU "Environment" "PATH"
1044               StrCpy $2 $1 1 -1  ; copy last char
1045               ${If} $2 == ";"    ; if last char == ;
1046                 StrCpy $1 $1 -1  ; remove last char
1047               ${Endif}
1048               ${If} $1 != ""
1049                 StrCpy $0 "$1;$0"
1050               ${Endif}
1051               WriteRegExpandStr HKCU "Environment" "PATH" $0
1052               SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
1053             ${Endif}
1054           ${Endif}
1055         ${Endif}
1056       ${Endif}
1057     ${Endif}
1058   ${EndIf}
1059
1060   Pop $4
1061   Pop $3
1062   Pop $2
1063   Pop $1
1064   Pop $0
1065 ${FunctionEnd}
1066
1067 ; RemoveFromPath - Remove a given dir from the path
1068 ;     Input: head of the stack
1069
1070 !macro SDCC.RemoveFromPath un
1071 ${Function} ${un}SDCC.RemoveFromPath
1072   Exch $0
1073   Push $1
1074   Push $2
1075   Push $3
1076   Push $4
1077   Push $5
1078   Push $6
1079
1080   IntFmt $6 "%c" 26 ; DOS EOF
1081
1082   Call ${un}SDCC.IsNT
1083   Pop $1
1084   ${If} $1 != 1
1085     ; Not on NT
1086     StrCpy $1 $WINDIR 2
1087     FileOpen $1 "$1\autoexec.bat" r
1088     GetTempFileName $4
1089     FileOpen $2 $4 w
1090     GetFullPathName /SHORT $0 $0
1091     StrCpy $0 "SET PATH=%PATH%;$0"
1092
1093   nextLine:
1094     ; copy all lines except the line containing "SET PATH=%PATH%;$0"
1095     ; from autoexec.bat to the temporary file
1096     ClearErrors
1097     FileRead $1 $3
1098     ${IfNot} ${Errors}
1099       StrCpy $5 $3 1 -1 ; read last char
1100       ${If} $5 == $6    ; if DOS EOF
1101         StrCpy $3 $3 -1 ; remove DOS EOF so we can compare
1102       ${EndIf}
1103       ${If} $3 != "$0$\r$\n"
1104         ${AndIf} $3 != "$0$\n"
1105         ${AndIf} $3 != "$0"
1106         FileWrite $2 $3
1107         Goto nextLine
1108       ${Else}
1109         ; This is the line I'm looking for:
1110         ; don't copy it
1111         ${DebugMsg} "removing line $0"
1112         ${DebugMsg} "SetRebootFlag true"
1113         SetRebootFlag true
1114         Goto nextLine
1115       ${EndIf}
1116     ${EndIf}
1117
1118     FileClose $2
1119     FileClose $1
1120     StrCpy $1 $WINDIR 2
1121     Delete "$1\autoexec.bat"
1122     CopyFiles /SILENT $4 "$1\autoexec.bat"
1123     Delete $4
1124   ${Else}
1125     ;System PATH variable is at:
1126     ;HKLM "/SYSTEM/CurrentControlSet/Control/Session Manager/Environment" "Path"
1127     ReadRegStr $1 HKCU "Environment" "PATH"
1128     StrCpy $5 $1 1 -1 ; copy last char
1129     ${If} $5 != ";"   ; if last char != ;
1130       StrCpy $1 "$1;" ; append ;
1131     ${EndIf}
1132     Push $1
1133     Push "$0;"
1134     Call ${un}StrStr  ; Find `$0;` in $1
1135     Pop $2            ; pos of our dir
1136     ${If} $2 != ""
1137       ; it is in path:
1138       ; $0 - path to add
1139       ; $1 - path var
1140       StrLen $3 "$0;"
1141       StrLen $4 $2
1142       StrCpy $5 $1 -$4   ; $5 is now the part before the path to remove
1143       StrCpy $6 $2 "" $3 ; $6 is now the part after the path to remove
1144       StrCpy $3 $5$6
1145
1146       StrCpy $5 $3 1 -1  ; copy last char
1147       ${If} $5 == ";"    ; if last char == ;
1148         StrCpy $3 $3 -1  ; remove last char
1149       ${EndIf}
1150       ${If} $3 != ""
1151         ; New PATH not empty: update the registry
1152         WriteRegExpandStr HKCU "Environment" "PATH" $3
1153       ${Else}
1154         ; New PATH empty: remove from the registry
1155         DeleteRegValue HKCU "Environment" "PATH"
1156       ${EndIf}
1157       SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
1158     ${Endif}
1159   ${Endif}
1160
1161   Pop $6
1162   Pop $5
1163   Pop $4
1164   Pop $3
1165   Pop $2
1166   Pop $1
1167   Pop $0
1168 ${FunctionEnd}
1169 !macroend
1170 !insertmacro SDCC.RemoveFromPath ""
1171 !insertmacro SDCC.RemoveFromPath "un."
1172
1173 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1174 ; Utility Functions                                                           ;
1175 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1176
1177 ; IsNT
1178 ; no input
1179 ; output, top of the stack = 1 if NT or 0 if not
1180 ;
1181 ; Usage:
1182 ;   Call IsNT
1183 ;   Pop $R0
1184 ;  ($R0 at this point is 1 or 0)
1185
1186 !macro SDCC.IsNT un
1187 ${Function} ${un}SDCC.IsNT
1188   Push $R0
1189   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
1190   ${If} $R0 == ""
1191     ; we are not NT.
1192     Pop $R0
1193     Push 0
1194   ${Else}
1195     ; NT!!!
1196     Pop $R0
1197     Push 1
1198   ${EndIf}
1199 ${FunctionEnd}
1200 !macroend
1201 !insertmacro SDCC.IsNT ""
1202 !insertmacro SDCC.IsNT "un."
1203
1204 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1205 ;  Uninstall/Reinstall page functions                                         ;
1206 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1207
1208 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
1209
1210 Var ReinstallPageCheck
1211
1212 ${Function} SDCC.PageReinstall
1213
1214   ReadRegStr $R0 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" ""
1215
1216   ${If} $R0 == ""
1217     ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
1218     ${If} $R0 == ""
1219       Abort
1220     ${EndIf}
1221   ${EndIf}
1222
1223   ReadRegDWORD $R0 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMajor"
1224   ReadRegDWORD $R1 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMinor"
1225   ReadRegDWORD $R2 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionRevision"
1226   ReadRegDWORD $R3 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionBuild"
1227   StrCpy $R0 $R0.$R1.$R2.$R3
1228
1229   ${VersionCompare} ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_BUILD} $R0 $R0
1230   ${If} $R0 == 0
1231     StrCpy $R1 "${PRODUCT_NAME} ${PRODUCT_VERSION} is already installed. Select the operation you want to perform and click Next to continue."
1232     StrCpy $R2 "Add/Reinstall components"
1233     StrCpy $R3 "Uninstall ${PRODUCT_NAME}"
1234     !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
1235     StrCpy $R0 "2"
1236   ${ElseIf} $R0 == 1
1237     StrCpy $R1 "An older version of ${PRODUCT_NAME} is installed on your system. It's recommended that you uninstall the current version before installing. Select the operation you want to perform and click Next to continue."
1238     StrCpy $R2 "Uninstall before installing"
1239     StrCpy $R3 "Do not uninstall"
1240     !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${PRODUCT_NAME}."
1241     StrCpy $R0 "1"
1242   ${ElseIf} $R0 == 2
1243     StrCpy $R1 "A newer version of ${PRODUCT_NAME} is already installed! It is not recommended that you install an older version. If you really want to install this older version, it's better to uninstall the current version first. Select the operation you want to perform and click Next to continue."
1244     StrCpy $R2 "Uninstall before installing"
1245     StrCpy $R3 "Do not uninstall"
1246     !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${PRODUCT_NAME}."
1247     StrCpy $R0 "1"
1248   ${Else}
1249     Abort
1250   ${EndIf}
1251
1252   nsDialogs::Create /NOUNLOAD 1018
1253
1254   ${NSD_CreateLabel} 0 0 100% 24u $R1
1255   Pop $R1
1256
1257   ${NSD_CreateRadioButton} 30u 50u -30u 8u $R2
1258   Pop $R2
1259   ${NSD_OnClick} $R2 SDCC.PageReinstallUpdateSelection
1260
1261   ${NSD_CreateRadioButton} 30u 70u -30u 8u $R3
1262   Pop $R3
1263   ${NSD_OnClick} $R3 SDCC.PageReinstallUpdateSelection
1264
1265   ${If} $ReinstallPageCheck != 2
1266     SendMessage $R2 ${BM_SETCHECK} ${BST_CHECKED} 0
1267   ${Else}
1268     SendMessage $R3 ${BM_SETCHECK} ${BST_CHECKED} 0
1269   ${EndIf}
1270
1271   nsDialogs::Show
1272
1273 ${FunctionEnd}
1274
1275 ${Function} SDCC.PageReinstallUpdateSelection
1276
1277   Pop $R1
1278
1279   ${NSD_GetState} $R2 $R1
1280
1281   ${If} $R1 == ${BST_CHECKED}
1282     StrCpy $ReinstallPageCheck 1
1283   ${Else}
1284     StrCpy $ReinstallPageCheck 2
1285   ${EndIf}
1286
1287 ${FunctionEnd}
1288
1289 ${Function} SDCC.PageLeaveReinstall
1290
1291   ${NSD_GetState} $R2 $R1
1292
1293   ${DebugMsg} "R0 = $R0, R1 = $R1, R2 = $R2"
1294
1295   ${If} $R0 == "1"
1296     ${AndIf} $R1 != "1"
1297     Goto reinst_done
1298   ${EndIf}
1299
1300   ${If} $R0 == "2"
1301     ${AndIf} $R1 == 1
1302     Goto reinst_done
1303   ${EndIf}
1304
1305   ReadRegStr $R1 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
1306
1307   ;Run uninstaller
1308   HideWindow
1309
1310   ${If} $R0 == "2"
1311     ; Uninstall only: uninstaller should be removed
1312     ClearErrors
1313     ; ExecWait doesn't wait if _?=$INSTDIR is not defined!
1314     ExecWait '$R1'
1315     Quit
1316   ${Else}
1317     ; Uninstal & Reinstall: uninstaller will be rewritten
1318     ClearErrors
1319     ; ExecWait doesn't wait if _?=$INSTDIR is not defined!
1320     ExecWait '$R1 _?=$INSTDIR'
1321   ${EndIf}
1322
1323   BringToFront
1324
1325 reinst_done:
1326
1327 ${FunctionEnd}
1328
1329 !endif # VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD