Subversion Repositories shark

Rev

Rev 1685 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1685 fabio 1
# Shark-specific bits of the build system.
2
# Include the configuration file.
3
topdir=$(if $(S),$(S),$(srctree))
4
include $(topdir)/shark.cfg
5
 
6
# Those are the targets used to build all the libraries that compose
7
# the system.  This is the only point (except local Makefiles, of course,
8
# that need to be added as needed) that has to be modified to add new files
9
# or directories to the main system.
10
# $(TARGETS) is the list of the main targets used to build the system,
11
# it contains all the directories recursed by the main Makefile, and the
12
# special target libgkern.a, that contains the base system.  To add a
13
# directory that specifies its own libraries simply put it in $(TARGETS).
14
TARGETS= libgkern.a drivers/ libc/ ports/ tracer/ $(fs-$(SHARK_FS))
15
 
16
# $(LIBGKERN-OBJS) is the list of targets that compose libgkern.a.  To
17
# add a directory to it, simply put it here.  The generic kernel used to
18
# be separed from the oslib and from the modules, but that hardly made
19
# sense for a Shark application, as all those three components are needed
20
# for it to run.
21
LIBGKERN-OBJS= arch/$(ARCH)/ kernel/ modules/
22
 
23
# Handle Shark configuration.  Really insane, indeed, btw there should
24
# not be the need to modify anything below this point in the file to
25
# handle common maintainance tasks.
26
options:=TSC APIC BIOS TRACER FG FB COMPILER
27
define strip-in-place
28
$(1):=$(strip $($(1)))
29
endef
30
$(foreach cfgopt,$(options),$(eval $(call strip-in-place,$(cfgopt))))
31
 
32
cpp-tsc-TRUE:= -D__TSC__
33
cpp-apic-TRUE:= -D__APIC__
34
cpp-bios-VM86:= -DVM86
35
cpp-tracer-NEW:= -D__NEW_TRACER__
36
cpp-tracer-OLD:= -D__OLD_TRACER__
37
cpp-fg-FORCE_PXC:= -D__FORCE_PXC__
38
cpp-fb-VESA:= -DCONFIG_FB_VESA -DCONFIG_LOGO
39
cpp-fb-FINDPCI:= -DCONFIG_FB_RIVA -DCONFIG_FB_RADEON -DCONFIG_FB_MATROX	\
40
	-DCONFIG_LOGO -DCONFIG_FB_MATROX_G100				\
41
	-DCONFIG_FB_MATROX_MILLENIUM -DCONFIG_FB_MATROX_MYSTIQUE
42
cpp-fb-VGA16:= -DCONFIG_FB_VGA16
43
 
44
include-dirs:=								\
45
	-I$(topdir)/include -I$(topdir)/modules				\
46
	-I$(topdir)/arch/$(ARCH)/include/arch				\
47
	-I$(topdir)/libc/arch/$(ARCH)/include				\
48
	-I$(topdir)/tracer/include
49
 
50
config:= -D__LINUX__							\
51
	$(cpp-tsc-$(TSC)) $(cpp-apic-$(APIC)) $(cpp-bios-$(BIOS))	\
52
	$(cpp-tracer-$(TRACER)) $(cpp-fg-$(FG)) $(cpp-fb-$(FB))
53
 
54
exported-cppflags:= $(include-dirs) $(config)
55
exported-aflags:= -x assembler-with-cpp $(include-dirs) $(config)
56
 
57
cc-compiler-GCC4:= -Wimplicit-function-declaration -Wno-attributes	\
58
	-Wno-pointer-sign -Wall -O -fno-builtin -nostdinc		\
59
	-minline-all-stringops -fno-stack-protector
60
cc-compiler-GCC3:= -Wimplicit-function-declaration -Wall -O		\
61
	-fno-builtin -nostdinc -minline-all-stringops
62
cc-compiler-DJGPP:= -Wimplicit-function-declaration -Wall -O		\
63
	-fno-builtin -nostdinc -minline-all-stringops
64
 
65
exported-cflags:= $(cc-compiler-$(COMPILER))
66
 
67
fs-YES:= fs/
68
 
69
ifndef APP
70
# If we are not building an application, just build the system libraries.
71
targets:= $(TARGETS)
72
libgkern.a-objs:= $(LIBGKERN-OBJS)
73
all: install
74
else
75
# Rules to build a Shark application.  The following variables are used:
76
# APP:		the application to build.
77
# INIT:		the initialization object file.
78
# OTHEROBJS:	other objects to be linked to the application.
79
# OTHERLIBS:	other libraries to be linked to the application.
80
# OTHERINCL:	additional preprocessor flags for the app and its
81
#		additional objects.
82
# SHARKOPT:	options to specify which Shark components are to be
83
#		linked to the application.
84
 
85
# Directory where we search for the compiled Shark libraries.
86
libs-dir:= $(if $(B),$(B)/.lib,$(if $(S),$(S)/.lib,\
87
	$(if $(BASE),$(BASE)/.lib,../../.lib)))
88
ifeq ($(wildcard $(libs-dir)),)
89
$(error Cannod find Shark build directory)
90
endif
91
 
92
# Handle $(SHARKOPT).  Always link the generic kernel and the architecture
93
# support code, as they're needed for the application to run.  Link the
94
# libc too, as we still don't have proper interface separation.
95
# XXX Bring back tracer and filesystem.
96
# XXX The old build system included also the ports and other libs...
97
app-libs:= -lgkern -lc -lcons -lserial
98
app-cppflags:= -I$(topdir)/drivers/linuxc26/include\
99
	-I$(topdir)/drivers/cons/include
100
 
101
wants-option=$(if $(filter $(1),$(uselib)),y)
102
 
103
use-zlib-y:= __ZLIB__
104
uselib:= $(SHARKOPT)
105
 
106
# PCI
107
libs-__PCI__-y:= -lpci
108
cppflags-__PCI__-y:= -I$(topdir)/drivers/pci/include
109
 
110
# Network
111
libs-__NET__-y:= -lnet
112
cppflags-__NET__-y:= -I$(topdir)/drivers/net/include
113
 
114
# grx
115
libs-__GRX__-y:= -lgrx
116
cppflags-__GRX__-y:= -I$(topdir)/drivers/grx/include
117
 
118
# Framebuffer
119
libs-__FB__-y:= -lfb
120
cppflags-__FB__-y:= -I$(topdir)/drivers/fb/include
121
 
122
# Oldchar
123
libs-__OLDCHAR__-y:= -loldch
124
cppflags-__OLDCHAR__-y:= -I$(topdir)/drivers/oldchar/include
125
 
126
# Linux compatibility layer
127
libs-__LINUXC26__-y:= -lcomp26
128
 
129
# PCL833
130
libs-__PCL833__-y:= -lpcl833
131
cppflags-__PCL833__-y:= -I$(topdir)/drivers/pcl833/include
132
 
133
# Parport
134
libs-__PPORT__-y:= -lpport
135
cppflags-__PPORT__-y:= -I$(topdir)/drivers/parport/include
136
 
137
# PCLAB
138
libs-__PCLAB__-y:= -lpclab
139
cppflags-__PCLAB__-y:= -I$(topdir)/drivers/pcl812/include
140
 
141
# BTTV
142
libs-__BTTV__-y:= -lbttv
143
cppflags-__BTTV__-y:= -I$(topdir)/drivers/bttv/include
144
 
145
# Input
146
libs-__INPUT__-y:= -linput
147
cppflags-__INPUT__-y:= -I$(topdir)/drivers/input/include
148
 
149
# CPU
150
libs-__CPU__-y:= -lcpu
151
cppflags-__CPU__-y:= -I$(topdir)/drivers/cpu/include
152
 
153
# USB
154
libs-__USB__-y:= -lusb
155
cppflags-__USB__-y:= -I$(topdir)/drivers/usb/include
156
 
157
# I2C
158
libs-__I2C__-y:= -li2c
159
cppflags-__I2C__-y:= -I$(topdir)/drivers/i2c/include
160
 
161
# 6025e
162
libs-__6025E__-y:= -l6025e
163
cppflags-__6025E__-y:= -I$(topdir)/drivers/pci6025e/include
164
 
165
# Mesa
166
libs-__OSMESA__-y:= -losmesa -lglut -lglu
167
cppflags-__OSMESA__-y:= -I$(topdir)/ports/mesa/include
168
 
169
# Servo
170
libs-__SERVO__-y:= -lservo
171
cppflags-__SERVO__-y:= -I$(topdir)/ports/servo/include
172
 
173
# TFTP
174
libs-__TFTP__-y:= -ltftp
175
cppflags-__TFTP__-y:= -I$(topdir)/ports/tftp/include
176
 
177
libs-tracer-OLD:= -ltracer -lnet -lpci -lcomp26
178
libs-tracer-NEW:= $(libs-tracer-OLD)
179
 
180
options= __PCI__ __NET__ __GRX__ __FB__ __OLDCHAR__ __LINUXC26__ __PCL833__\
181
	__PPORT__ __PCLAB__ __BTTV__ __INPUT__ __CPU__ __USB__ __I2C__ \
182
	__6025E__ __OSMESA__ __SERVO__ __TFTP__
183
 
184
app-libs+= $(foreach opt,$(options),$(libs-$(opt)-$(call wants-option,$(opt))))
185
app-cppflags+= $(foreach opt,$(options),$(cppflags-$(opt)-$(call\
186
	wants-option,$(opt))))
187
 
188
app-libs+= $(libs-tracer-$(TRACER))
189
 
190
targets:= $(APP)
191
$(APP)-objs:= $(APP).o $(OTHEROBJS)
192
$(APP)-startup:= $(libs-dir)/x0.o
193
$(APP)-cppflags+= $(OTHERINCL) $(app-cppflags)
194
$(APP)-ldflags+= -Bstatic -Ttext $(MEM_START) -s -nostartfiles -nostdlib\
195
	-L$(libs-dir) --start-group $(sort $(app-libs)) $(OTHERLIBS) --end-group
196
endif
197