source: mainline/uspace/lib/libc/Makefile.build@ 8e33e1d

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 8e33e1d was 8786aa5, checked in by Martin Decky <martin@…>, 16 years ago

remove Stanse-specific constructs from makefiles
add generic support for checkers via generating an universal jobfiles (for kernel, boot loader, libraries and tasks)
add Stanse preprocessor which uses this universal jobfiles to run Stanse

  • Property mode set to 100644
File size: 3.9 KB
Line 
1#
2# Copyright (c) 2005 Martin Decky
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8#
9# - Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# - Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14# - The name of the author may not be used to endorse or promote products
15# derived from this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28
29## Common compiler flags
30#
31
32LIBC_PREFIX = $(shell pwd)
33SOFTINT_PREFIX = ../softint
34LINK = arch/$(UARCH)/_link.ld
35
36
37## Setup toolchain
38#
39
40include Makefile.common
41include Makefile.toolchain
42
43
44## Sources
45#
46
47GENERIC_SOURCES = \
48 generic/libc.c \
49 generic/ddi.c \
50 generic/as.c \
51 generic/cap.c \
52 generic/clipboard.c \
53 generic/devmap.c \
54 generic/event.c \
55 generic/errno.c \
56 generic/mem.c \
57 generic/string.c \
58 generic/fibril.c \
59 generic/fibril_synch.c \
60 generic/pcb.c \
61 generic/smc.c \
62 generic/thread.c \
63 generic/tls.c \
64 generic/task.c \
65 generic/futex.c \
66 generic/io/asprintf.c \
67 generic/io/io.c \
68 generic/io/printf.c \
69 generic/io/klog.c \
70 generic/io/snprintf.c \
71 generic/io/vprintf.c \
72 generic/io/vsnprintf.c \
73 generic/io/printf_core.c \
74 generic/io/console.c \
75 generic/malloc.c \
76 generic/sysinfo.c \
77 generic/ipc.c \
78 generic/async.c \
79 generic/loader.c \
80 generic/getopt.c \
81 generic/adt/list.o \
82 generic/adt/hash_table.o \
83 generic/time.c \
84 generic/err.c \
85 generic/stdlib.c \
86 generic/mman.c \
87 generic/udebug.c \
88 generic/vfs/vfs.c \
89 generic/vfs/canonify.c \
90 generic/stacktrace.c
91
92ARCH_SOURCES += \
93 arch/$(UARCH)/src/entry.s \
94 arch/$(UARCH)/src/thread_entry.s
95
96GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
97ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
98OBJECTS := $(GENERIC_OBJECTS) $(ARCH_OBJECTS)
99
100.PHONY: all
101
102all: $(LIBC) $(LINK)
103
104-include $(DEPEND)
105
106$(LIBC): $(ARCH_OBJECTS) $(GENERIC_OBJECTS)
107 $(AR) rc $@ $(ARCH_OBJECTS) $(GENERIC_OBJECTS)
108
109$(LINK): $(LINK).in
110 $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
111
112%.o: %.S $(DEPEND)
113 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
114ifeq ($(PRECHECK),y)
115 $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__
116endif
117
118%.o: %.s $(DEPEND)
119 $(AS) $(AFLAGS) $< -o $@
120ifeq ($(PRECHECK),y)
121 $(JOBFILE) $(JOB) $< $@ as asm $(AFLAGS)
122endif
123
124%.o: %.c $(DEPEND)
125 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@
126ifeq ($(PRECHECK),y)
127 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
128endif
129
130$(DEPEND): $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH)
131 makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENERIC_SOURCES) > $@ 2> /dev/null
132 -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
133
134$(INCLUDE_ARCH): $(INCLUDE_KERNEL) $(INCLUDE_KERNEL)/arch
135 ln -sfn kernel/arch $@
136
137$(INCLUDE_LIBARCH): arch/$(UARCH)/include
138 ln -sfn ../$< $@
139
140$(INCLUDE_KERNEL)/arch: ../../../kernel/generic/include/arch $(INCLUDE_KERNEL)
141
142$(INCLUDE_KERNEL): ../../../kernel/generic/include/
143 ln -sfn ../$< $@
Note: See TracBrowser for help on using the repository browser.