Browse Source

[build] Fix building on FreeBSD

FreeBSD requires the object format to be specified as elf_i386_fbsd,
rather than elf_i386.

Based on a patch from Eygene Ryabinkin <rea-fbsd@codelabs.ru>
tags/v0.9.6
Michael Brown 15 years ago
parent
commit
d9c38d14d6
2 changed files with 14 additions and 2 deletions
  1. 8
    0
      src/Makefile.housekeeping
  2. 6
    2
      src/arch/i386/Makefile

+ 8
- 0
src/Makefile.housekeeping View File

@@ -52,6 +52,14 @@ VERYCLEANUP	+= .echocheck
52 52
 echo :
53 53
 	@$(ECHO) "Using \"$(ECHO_E)\" for \"echo -e\""
54 54
 
55
+###############################################################################
56
+#
57
+# Determine host OS
58
+#
59
+HOST_OS		:= $(shell uname -s)
60
+hostos :
61
+	@$(ECHO) $(HOST_OS)
62
+
55 63
 ###############################################################################
56 64
 #
57 65
 # Check for tools that can cause failed builds

+ 6
- 2
src/arch/i386/Makefile View File

@@ -38,8 +38,12 @@ CFLAGS		+= -freg-struct-return
38 38
 # Force 32-bit code even on an x86-64 machine
39 39
 #
40 40
 CFLAGS		+= -m32
41
-ASFLAGS         += --32
42
-LDFLAGS         += -m elf_i386
41
+ASFLAGS		+= --32
42
+ifeq ($(HOST_OS),FreeBSD)
43
+LDFLAGS		+= -m elf_i386_fbsd
44
+else
45
+LDFLAGS		+= -m elf_i386
46
+endif
43 47
 
44 48
 # EFI requires -fshort-wchar, and nothing else currently uses wchar_t
45 49
 #

Loading…
Cancel
Save