OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [Rules.make] - Blame information for rev 1777

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1622 jcastillo
#
2
# This file contains rules which are shared between multiple Makefiles.
3
#
4
 
5
#
6
# False targets.
7
#
8
.PHONY: dummy
9
 
10
#
11
# Special variables which should not be exported
12
#
13
unexport EXTRA_ASFLAGS
14
unexport EXTRA_CFLAGS
15
unexport EXTRA_LDFLAGS
16
unexport EXTRA_ARFLAGS
17
unexport SUBDIRS
18
unexport SUB_DIRS
19
unexport ALL_SUB_DIRS
20
unexport MOD_SUB_DIRS
21
unexport O_TARGET
22
unexport O_OBJS
23
unexport L_OBJS
24
unexport M_OBJS
25
unexport MI_OBJS
26
unexport ALL_MOBJS
27
# objects that export symbol tables
28
unexport OX_OBJS
29
unexport LX_OBJS
30
unexport MX_OBJS
31
unexport MIX_OBJS
32
unexport SYMTAB_OBJS
33
 
34
unexport MOD_LIST_NAME
35
 
36
#
37
# Get things started.
38
#
39
first_rule: sub_dirs
40
        $(MAKE) all_targets
41
 
42
#
43
# Common rules
44
#
45
 
46
%.s: %.c
47
        $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -S $< -o $@
48
 
49
%.o: %.c
50
        $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
51
 
52
%.o: %.s
53
        $(AS) $(ASFLAGS) $(EXTRA_CFLAGS) -o $@ $<
54
 
55
#
56
#
57
#
58
all_targets: $(O_TARGET) $(L_TARGET)
59
 
60
#
61
# Rule to compile a set of .o files into one .o file
62
#
63
ifdef O_TARGET
64
ALL_O = $(OX_OBJS) $(O_OBJS)
65
$(O_TARGET): $(ALL_O) $(TOPDIR)/include/linux/config.h
66
        rm -f $@
67
ifneq "$(strip $(ALL_O))" ""
68
        $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(ALL_O)
69
else
70
        $(AR) rcs $@
71
endif
72
endif
73
 
74
#
75
# Rule to compile a set of .o files into one .a file
76
#
77
ifdef L_TARGET
78
$(L_TARGET): $(LX_OBJS) $(L_OBJS) $(TOPDIR)/include/linux/config.h
79
        rm -f $@
80
        $(AR) $(EXTRA_ARFLAGS) rcs $@ $(LX_OBJS) $(L_OBJS)
81
endif
82
 
83
#
84
# This make dependencies quickly
85
#
86
fastdep: dummy
87
        if [ -n "$(wildcard *.[chS])" ]; then \
88
        $(TOPDIR)/scripts/mkdep *.[chS] > .depend; fi
89
ifdef ALL_SUB_DIRS
90
        set -e; for i in $(ALL_SUB_DIRS); do $(MAKE) -C $$i fastdep; done
91
endif
92
 
93
#
94
# A rule to make subdirectories
95
#
96
sub_dirs: dummy
97
ifdef SUB_DIRS
98
        set -e; for i in $(SUB_DIRS); do $(MAKE) -C $$i; done
99
endif
100
 
101
#
102
# A rule to make modules
103
#
104
ALL_MOBJS = $(MX_OBJS) $(M_OBJS)
105
ifneq "$(strip $(ALL_MOBJS))" ""
106
PDWN=$(shell $(CONFIG_SHELL) $(TOPDIR)/scripts/pathdown.sh)
107
endif
108
modules: $(ALL_MOBJS) $(MIX_OBJS) $(MI_OBJS) dummy
109
ifdef MOD_SUB_DIRS
110
        set -e; for i in $(MOD_SUB_DIRS); do $(MAKE) -C $$i modules; done
111
endif
112
ifneq "$(strip $(MOD_LIST_NAME))" ""
113
        rm -f $$TOPDIR/modules/$(MOD_LIST_NAME)
114
ifdef MOD_SUB_DIRS
115
        for i in $(MOD_SUB_DIRS); do \
116
            echo `basename $$i`.o >> $$TOPDIR/modules/$(MOD_LIST_NAME); done
117
endif
118
ifneq "$(strip $(ALL_MOBJS))" ""
119
        echo $(ALL_MOBJS) >> $$TOPDIR/modules/$(MOD_LIST_NAME)
120
endif
121
endif
122
ifneq "$(strip $(ALL_MOBJS))" ""
123
        echo $(PDWN)
124
        cd $$TOPDIR/modules; for i in $(ALL_MOBJS); do \
125
            ln -sf ../$(PDWN)/$$i .; done
126
endif
127
 
128
#
129
# A rule to do nothing
130
#
131
dummy:
132
 
133
#
134
# This is useful for testing
135
#
136
script:
137
        $(SCRIPT)
138
 
139
#
140
# This sets version suffixes on exported symbols
141
# Uses SYMTAB_OBJS
142
# Separate the object into "normal" objects and "exporting" objects
143
# Exporting objects are: all objects that define symbol tables
144
#
145
ifdef CONFIG_MODVERSIONS
146
SYMTAB_OBJS = $(LX_OBJS) $(OX_OBJS) $(MX_OBJS) $(MIX_OBJS)
147
ifneq "$(strip $(SYMTAB_OBJS))" ""
148
 
149
MODINCL = $(TOPDIR)/include/linux/modules
150
 
151
# The -w option (enable warnings) for /bin/genksyms will return here in 2.1
152
$(MODINCL)/%.ver: %.c
153
        @if [ ! -x /sbin/genksyms ]; then echo "Please read: Documentation/modules.txt"; fi
154
        $(CC) $(CFLAGS) -E -D__GENKSYMS__ $< | /sbin/genksyms $(MODINCL)
155
 
156
$(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)): $(TOPDIR)/include/linux/autoconf.h
157
 
158
.PHONY: $(TOPDIR)/include/linux/modversions.h
159
 
160
$(TOPDIR)/include/linux/modversions.h: $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver))
161
        @echo updating $(TOPDIR)/include/linux/modversions.h
162
        @(echo "#ifdef MODVERSIONS";\
163
        echo "#undef  CONFIG_MODVERSIONS";\
164
        echo "#define CONFIG_MODVERSIONS";\
165
        echo "#ifndef _set_ver";\
166
        echo "#define _set_ver(sym,vers) sym ## _R ## vers";\
167
        echo "#endif";\
168
        cd $(TOPDIR)/include/linux/modules; for f in *.ver;\
169
        do echo "#include "; done; \
170
        echo "#undef  CONFIG_MODVERSIONS";\
171
        echo "#endif") \
172
        > $(TOPDIR)/include/linux/modversions.h
173
 
174
$(MX_OBJS): $(TOPDIR)/include/linux/modversions.h
175
        $(CC) $(CFLAGS) -DEXPORT_SYMTAB -c $(@:.o=.c)
176
 
177
$(LX_OBJS) $(OX_OBJS): $(TOPDIR)/include/linux/modversions.h
178
        $(CC) $(CFLAGS) -DMODVERSIONS -DEXPORT_SYMTAB -c $(@:.o=.c)
179
 
180
dep fastdep: $(TOPDIR)/include/linux/modversions.h
181
 
182
endif
183
$(M_OBJS): $(TOPDIR)/include/linux/modversions.h
184
ifdef MAKING_MODULES
185
$(O_OBJS) $(L_OBJS): $(TOPDIR)/include/linux/modversions.h
186
endif
187
# This is needed to ensure proper dependency for multipart modules such as
188
# fs/ext.o.  (Otherwise, not all subobjects will be recompiled when
189
# version information changes.)
190
 
191
endif
192
 
193
#
194
# include dependency files they exist
195
#
196
ifeq (.depend,$(wildcard .depend))
197
include .depend
198
endif
199
 
200
ifeq ($(TOPDIR)/.hdepend,$(wildcard $(TOPDIR)/.hdepend))
201
include $(TOPDIR)/.hdepend
202
endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.