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