Permalink
Browse files

Automatically detect architecture and compile appropriate 32-bit or 6…

…4-bit dll
  • Loading branch information...
1 parent 3591226 commit f2444acd1c3901479e04ce8e960068fb3d7a169c @grompe committed Jun 12, 2016
Showing with 35 additions and 22 deletions.
  1. +1 −1 base.inc
  2. +1 −0 detect_amd64.inc
  3. +1 −0 detect_x86.inc
  4. +11 −15 diskbd.bat
  5. +7 −2 kbdusru.asm
  6. +7 −2 kbdusru_undead.asm
  7. +7 −2 layouts/workman.asm
View
@@ -1,4 +1,4 @@
-; Detect between 32 and 64 bits
+; Detect whether we're assembling in 32 or 64 bits
virtual at 0
xchg eax,eax
detected_32bit = $-2
View
@@ -0,0 +1 @@
+SYSTEM_64BIT = 1
View
@@ -0,0 +1 @@
+SYSTEM_64BIT = 0
View
@@ -553,21 +553,17 @@ end virtual
; ----------------------------------------------------------------------------
db 0EFh,0BBh,0BFh,'="utf8"',13,10
-if machine = MACHINE_64BIT
- db "format PE64 DLL native 5.0 at "
- db_hex 64,image_base
- db ' on "nul" as "dll" ; Build for 64-bit Windows',13,10
- db ";format PE DLL native 5.0 at "
- db_hex 32,image_base
- db ' on "nul" as "dll" ; Build for 32-bit Windows or WOW64',13,10
-else
- db "format PE DLL native 5.0 at "
- db_hex 32,image_base
- db ' on "nul" as "dll" ; Build for 32-bit Windows or WOW64',13,10
- db ";format PE64 DLL native 5.0 at "
- db_hex 64,image_base
- db ' on "nul" as "dll" ; Build for 64-bit Windows',13,10
-end if
+db 'include "detect_%processor_architecture%.inc"',13,10
+db 13,10
+db 'if SYSTEM_64BIT',13,10
+db " format PE64 DLL native 5.0 at "
+db_hex 64,image_base
+db ' on "nul" as "dll" ; Build for 64-bit Windows',13,10
+db 'else',13,10
+db " format PE DLL native 5.0 at "
+db_hex 32,image_base
+db ' on "nul" as "dll" ; Build for 32-bit Windows or WOW64',13,10
+db 'end if',13,10
db 13,10
db 'MAKE_DLL equ 1',13,10
View
@@ -3,8 +3,13 @@
; kbdusru - US/RU hybrid keyboard layout with Caps Lock remapped to Kana
; to switch languages
-format PE64 DLL native 5.0 at 5ffffff0000h on "nul" as "dll" ; Build for 64-bit Windows
-;format PE DLL native 5.0 at 5fff0000h on "nul" as "dll" ; Build for 32-bit Windows or WOW64
+include "detect_%processor_architecture%.inc"
+
+if SYSTEM_64BIT
+ format PE64 DLL native 5.0 at 5ffffff0000h on "nul" as "dll" ; Build for 64-bit Windows
+else
+ format PE DLL native 5.0 at 5fff0000h on "nul" as "dll" ; Build for 32-bit Windows or WOW64
+end if
MAKE_DLL equ 1
View
@@ -3,8 +3,13 @@
; kbdusru_undead - US/RU hybrid keyboard layout with Caps Lock set to switch
; languages and "undead keys" for additional symbols
-format PE64 DLL native 5.0 at 5ffffff0000h on "nul" as "dll" ; Build for 64-bit Windows
-;format PE DLL native 5.0 at 5fff0000h on "nul" as "dll" ; Build for 32-bit Windows or WOW64
+include "detect_%processor_architecture%.inc"
+
+if SYSTEM_64BIT
+ format PE64 DLL native 5.0 at 5ffffff0000h on "nul" as "dll" ; Build for 64-bit Windows
+else
+ format PE DLL native 5.0 at 5fff0000h on "nul" as "dll" ; Build for 32-bit Windows or WOW64
+end if
MAKE_DLL equ 1
View
@@ -4,8 +4,13 @@
; http://www.workmanlayout.com/forum/
; https://viralintrospection.wordpress.com/2010/09/06/a-different-philosophy-in-designing-keyboard-layouts/
-format PE64 DLL native 5.0 at 0x0000000180000000 on "nul" as "dll" ; Build for 64-bit Windows
-;format PE DLL native 5.0 at 0x80000000 on "nul" as "dll" ; Build for 32-bit Windows or WOW64
+include "../detect_%processor_architecture%.inc"
+
+if SYSTEM_64BIT
+ format PE64 DLL native 5.0 at 0x0000000180000000 on "nul" as "dll" ; Build for 64-bit Windows
+else
+ format PE DLL native 5.0 at 0x18000000 on "nul" as "dll" ; Build for 32-bit Windows or WOW64
+end if
WORKMAN_PROGRAMMER = 0 ; Set to 1 to swap 1234567890 and !@#$%^&*()
WORKMAN_UK = 0 ; Set to 1 for UK layout

0 comments on commit f2444ac

Please sign in to comment.