source: mainline/uspace/Makefile.common@ d3b6d5e

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since d3b6d5e was eb1a2f4, checked in by Vojtech Horky <vojtechhorky@…>, 14 years ago

Merge mainline changes (DDF refactoring)

This merge includes DDF refactoring that brought multifunctional devices
(i.e. ddf_dev_t and ddf_fun_t). Please, see ticket #295 at HelenOS
upstream Trac.

The conflicts themselves were easy to solve (merely several renamings).

Changes to USB subsystem:

  • drivers uses ddf_dev_t and ddf_fun_t
  • different signatures of many library functions
  • several hacks around communication with parent device (now the communication is clearer and somehow what we have now is hack about other hacks)
    • will repair and clean later
  • maybe added some extra debugging messages (the diff has about 240K, and I admit I have no energy to double check that)

WARNING:

  • the diff is VERY long, recommended is viewing partial diffs of the merge (i.e. merges in mainline branch that lead to the parent one)
  • merging with your branches might involve huge renamings, sorry, no other way is possible

BUGS:

  • hub driver will not work (no function created)

GOOD NEWS:

  • QEMU keyboard seems to work with QEMU 0.13 and 0.14
  • we are up-to-date with mainline again
  • Property mode set to 100644
File size: 6.8 KB
Line 
1#
2# Copyright (c) 2005 Martin Decky
3# Copyright (c) 2007 Jakub Jermar
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9#
10# - Redistributions of source code must retain the above copyright
11# notice, this list of conditions and the following disclaimer.
12# - Redistributions in binary form must reproduce the above copyright
13# notice, this list of conditions and the following disclaimer in the
14# documentation and/or other materials provided with the distribution.
15# - The name of the author may not be used to endorse or promote products
16# derived from this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28#
29
30# Individual makefiles set:
31#
32# USPACE_PREFIX (*) relative path to uspace/ directory
33# SOURCES (*) list of source files
34# LIBS libraries to link with
35# DEFS compiler defines
36# EXTRA_CFLAGS additional flags to pass to C compiler
37# LINKER_SCRIPT linker script
38# PRE_DEPEND targets required for dependency check
39#
40# BINARY (/) binary output name (like appname)
41# LIBRARY (/) library output name (like libname)
42# EXTRA_OUTPUT additional output targets
43# EXTRA_CLEAN additional cleanup targets
44#
45# (x) required variables
46# (/) exactly one of the variables must be defined
47#
48
49ROOT_PATH = $(USPACE_PREFIX)/..
50
51VERSION_DEF = $(ROOT_PATH)/version
52
53COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
54COMMON_HEADER = $(ROOT_PATH)/common.h
55
56CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
57CONFIG_HEADER = $(ROOT_PATH)/config.h
58
59-include $(VERSION_DEF)
60-include $(COMMON_MAKEFILE)
61-include $(CONFIG_MAKEFILE)
62
63ifneq ($(BINARY),)
64 JOB = $(BINARY).job
65 OUTPUT = $(BINARY)
66 EXTRA_OUTPUT += $(BINARY).disasm
67 EXTRA_CLEAN += $(BINARY).map
68endif
69
70ifneq ($(LIBRARY),)
71 JOB = $(LIBRARY).job
72 OUTPUT = $(LIBRARY).a
73endif
74
75DEPEND = Makefile.depend
76DEPEND_PREV = $(DEPEND).prev
77
78LIB_PREFIX = $(USPACE_PREFIX)/lib
79
80LIBC_PREFIX = $(LIB_PREFIX)/c
81LIBSOFTFLOAT_PREFIX = $(LIB_PREFIX)/softfloat
82LIBSOFTINT_PREFIX = $(LIB_PREFIX)/softint
83
84LIBBLOCK_PREFIX = $(LIB_PREFIX)/block
85LIBFS_PREFIX = $(LIB_PREFIX)/fs
86LIBCLUI_PREFIX = $(LIB_PREFIX)/clui
87
88
89LIBUSB_PREFIX = $(LIB_PREFIX)/usb
90LIBUSBVIRT_PREFIX = $(LIB_PREFIX)/usbvirt
91LIBDRV_PREFIX = $(LIB_PREFIX)/drv
92LIBPACKET_PREFIX = $(LIB_PREFIX)/packet
93LIBNET_PREFIX = $(LIB_PREFIX)/net
94
95BASE_LIBS = $(LIBC_PREFIX)/libc.a $(LIBSOFTINT_PREFIX)/libsoftint.a
96
97LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld
98
99ifeq ($(CONFIG_OPTIMIZE_FOR_SIZE),y)
100 OPTIMIZATION = s
101else
102 OPTIMIZATION = 3
103endif
104
105.PHONY: all clean
106
107all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(EXTRA_OUTPUT)
108 -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
109
110clean:
111 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)
112 find . -name '*.o' -follow -exec rm \{\} \;
113
114GCC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
115 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
116 -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
117 -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
118 -Werror-implicit-function-declaration -Wwrite-strings \
119 -pipe -g -D__$(ENDIANESS)__
120
121ICC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
122 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
123 -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
124 -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
125 -Werror-implicit-function-declaration -Wwrite-strings \
126 -pipe -g -D__$(ENDIANESS)__
127
128CLANG_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
129 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
130 -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
131 -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
132 -Werror-implicit-function-declaration -Wwrite-strings \
133 -pipe -g -arch $(CLANG_ARCH) -D__$(ENDIANESS)__
134
135ifeq ($(CONFIG_DEBUG),y)
136 GCC_CFLAGS += -Werror
137 ICC_CFLAGS += -Werror
138endif
139
140ifeq ($(CONFIG_LINE_DEBUG),y)
141 GCC_CFLAGS += -g
142 ICC_CFLAGS += -g
143 SUNCC_CFLAGS += -g
144 CLANG_CFLAGS += -g
145endif
146
147## Setup platform configuration
148#
149
150-include $(LIBC_PREFIX)/arch/$(UARCH)/Makefile.common
151
152## Compilation options
153#
154
155JOBFILE = $(LIBC_PREFIX)/../../../tools/jobfile.py
156
157ifeq ($(COMPILER),gcc_cross)
158 CFLAGS = $(GCC_CFLAGS) $(EXTRA_CFLAGS)
159 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
160endif
161
162ifeq ($(COMPILER),gcc_native)
163 CFLAGS = $(GCC_CFLAGS) $(EXTRA_CFLAGS)
164 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
165endif
166
167ifeq ($(COMPILER),icc)
168 CFLAGS = $(ICC_CFLAGS) $(EXTRA_CFLAGS)
169 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
170endif
171
172ifeq ($(COMPILER),clang)
173 CFLAGS = $(CLANG_CFLAGS) $(EXTRA_CFLAGS)
174 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
175endif
176
177-include $(DEPEND)
178
179OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
180
181ifneq ($(BINARY),)
182%.disasm: $(BINARY)
183ifeq ($(CONFIG_LINE_DEBUG),y)
184 $(OBJDUMP) -d -S $< > $@
185else
186 $(OBJDUMP) -d $< > $@
187endif
188
189$(BINARY): $(LINKER_SCRIPT) $(OBJECTS) $(LIBS) $(BASE_LIBS)
190 $(LD) -N $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $(BINARY) $(OBJECTS) $(LIBS) $(BASE_LIBS)
191ifeq ($(CONFIG_STRIP_BINARIES),y)
192 $(STRIP) $(BINARY)
193endif
194endif
195
196ifneq ($(LIBRARY),)
197%.a: $(OBJECTS)
198 $(AR) rc $@ $(OBJECTS)
199endif
200
201%.o: %.S $(DEPEND)
202 $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
203ifeq ($(PRECHECK),y)
204 $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) -D__ASM__
205endif
206
207%.o: %.s $(DEPEND)
208 $(AS) $(AFLAGS) -o $@ $<
209ifeq ($(PRECHECK),y)
210 $(JOBFILE) $(JOB) $< $@ as asm
211endif
212
213%.o: %.c $(DEPEND)
214 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@
215ifeq ($(PRECHECK),y)
216 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
217endif
218
219$(DEPEND): $(PRE_DEPEND)
220 makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
221 -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
222
223##
224# This explicit dependecy of the output binary on the object files seems to be
225# necessary to prevent parallel build failures (GNU make bug #26893 ???).
226$(OUTPUT): $(OBJECTS)
227
Note: See TracBrowser for help on using the repository browser.