]> git.buserror.net Git - polintos/scott/priv.git/blob - Makefile.target
2943437f1e0a2bb2be031846471da2ead3f10059
[polintos/scott/priv.git] / Makefile.target
1 ifndef TARGETDEFS
2 TARGETDEFS := done
3
4 ifndef ARCH
5 $(error Please define $$(ARCH).)
6 endif
7
8 VALIDARCH := no
9 DEFS := $(EXTRADEFS)
10
11 ifeq ($(ARCH),x86)
12 CROSS := i686-polintos-
13 DEFS += -DBITFIELD_LE
14 VALIDARCH := yes
15 endif
16
17 ifeq ($(ARCH),x64)
18 CROSS := x86_64-polintos-
19 DEFS += -DBITFIELD_LE
20 VALIDARCH := yes
21 endif
22
23 ifeq ($(VALIDARCH),no)
24 $(error $(ARCH) is not a supported target.)
25 endif
26
27 ifndef USECROSS
28 CROSS :=
29 endif
30
31 ifdef NOSMP
32 DEFS += -D_LL_NOSMP
33 endif
34
35 # C++ prohibits defeferencing a NULL non-POD pointer (and thus
36 # prohibits using offsetof on non-POD types, even though there's no
37 # good reason to disallow it).  Some headers use offsetof on non-POD
38 # types (typically, the types are non-POD only because they have a
39 # constructor to initialize fields to a known state (or with
40 # passed-in values); hardly a reason to make it completely non-POD
41 # and throw out a bazillion otherwise legal actions).
42 #
43 # Thus, since I know of no way (such as a #pragma) for code to
44 # disable a warning itself for a specific region of code, everything
45 # needs to disable this warning.  On one hand, I consider it a bogus
46 # warning, and thus it's not that big of a deal.  On the other hand,
47 # having the warning suppressed means you won't know if your code
48 # will produce the warning in other environments without actually
49 # trying it there.  Oh well; blame the C++ and/or GCC people, not me.
50 #
51 # This warning option requires at least GCC 3.4.  If you want to use
52 # an older compiler, remove this and live with the warnings (as well
53 # as whatever other unknown issues you encounter).
54
55 CXXWARN += $(WARN) -Wno-invalid-offsetof
56
57 ifndef BUILDTYPE
58 BUILDTYPE := user
59 endif
60
61 BUILDNAME := build
62 BASEBUILDDIR := $(TOP)/$(BUILDNAME)
63 ARCHBUILDDIR := $(TOP)/$(BUILDNAME)/$(ARCH)
64
65 ifeq ($(ARCHINDEP),y)
66 BUILDDIR := $(BASEBUILDDIR)/$(BUILDTYPE)/$(COMP)
67 else
68 BUILDDIR := $(ARCHBUILDDIR)/$(BUILDTYPE)/$(COMP)
69 endif
70
71 UTILBUILDDIR := $(BASEBUILDDIR)/build/utils
72 SERVERDIR := $(BUILDDIR)/include/servers
73
74 IFACES := $(BASEBUILDDIR)/build/idl/ifaces
75 GENINCLUDES := $(ARCHBUILDDIR)/build/include/generated
76
77 BUILDCC := gcc
78 BUILDCXX := g++
79 CC := $(CROSS)gcc
80 CXX := $(CROSS)g++
81 AS := $(CROSS)as
82 AR := $(CROSS)ar
83 LD := $(CROSS)ld
84 STRIP := $(CROSS)strip
85 DEFS += -D_LL_ARCH_$(ARCH) -D_LL_ARCH=$(ARCH)
86 MKDIR := mkdir -p
87 MV := mv
88 RANLIB := $(CROSS)ranlib
89 RM := rm -f
90 RMDIR := rm -rf
91 LN := ln -s
92 IDLC := $(BASEBUILDDIR)/build/idlcomp/idlc
93 TOUCH := touch
94 BISON := bison
95 FLEX := flex
96
97 # If you want to cross-compile idlc, set BUILD_ENDIAN to LE or BE
98 # and build only the idlc component.  Also, set BUILDCXX to the
99 # cross compiler.
100
101 ifndef BUILD_ENDIAN
102 $(shell $(MKDIR) $(UTILBUILDDIR))
103 $(shell $(BUILDCC) $(TOP)/utils/buildendian.c -o $(UTILBUILDDIR)/buildendian)
104 BUILD_ENDIAN := $(shell $(UTILBUILDDIR)/buildendian)
105 endif
106
107 ifndef BUILD_BFENDIAN
108 $(shell $(MKDIR) $(UTILBUILDDIR))
109 $(shell $(BUILDCC) $(TOP)/utils/buildbfendian.c -o $(UTILBUILDDIR)/buildbfendian)
110 BUILD_BFENDIAN := $(shell $(UTILBUILDDIR)/buildendian)
111 endif
112
113 BUILDDEFS += -DBITFIELD_$(BUILD_BFENDIAN)
114
115 endif