source: trunk/libs/newlib/src/libgloss/riscv/Makefile.in @ 498

Last change on this file since 498 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 6.7 KB
Line 
1#-------------------------------------------------------------------------
2# Source files
3#-------------------------------------------------------------------------
4
5gloss_hdrs = \
6        machine/syscall.h \
7
8gloss_srcs = \
9        nanosleep.c \
10        sys_access.c \
11        sys_chdir.c \
12        sys_chmod.c \
13        sys_chown.c \
14        sys_close.c \
15        sys_conv_stat.c \
16        sys_execve.c \
17        sys_exit.c \
18        sys_faccessat.c \
19        sys_fork.c \
20        sys_fstatat.c \
21        sys_fstat.c \
22        sys_ftime.c \
23        sys_getcwd.c \
24        sys_getpid.c \
25        sys_gettimeofday.c \
26        sys_isatty.c \
27        sys_kill.c \
28        sys_link.c \
29        sys_lseek.c \
30        sys_lstat.c \
31        sys_openat.c \
32        sys_open.c \
33        sys_read.c \
34        sys_sbrk.c \
35        sys_stat.c \
36        sys_sysconf.c \
37        sys_times.c \
38        sys_unlink.c \
39        sys_utime.c \
40        sys_wait.c \
41        sys_write.c
42
43gloss_specs = \
44        nano.specs sim.specs
45
46# Extra files
47
48crt0_asm      = crt0.S
49
50# Multilib support variables.
51# TOP is used instead of MULTI{BUILD,SRC}TOP.
52
53MULTIDIRS =
54MULTISUBDIR =
55MULTIDO = true
56MULTICLEAN = true
57
58#-------------------------------------------------------------------------
59# Basic setup
60#-------------------------------------------------------------------------
61
62# Remove all default implicit rules since they can cause subtle bugs
63# and they just make things run slower
64
65.SUFFIXES:
66% : %,v
67% : RCS/%,v
68% : RCS/%
69% : s.%
70% : SCCS/s.%
71
72# Default is to build the prereqs of the all target (defined at bottom)
73
74default : all
75.PHONY : default
76
77# Source directory
78
79obj_dir := .
80src_dir := @srcdir@
81VPATH   := $(src_dir) $(src_dir)/machine
82
83# Installation directories
84
85prefix  := @prefix@
86DESTDIR ?= $(prefix)
87
88install_hdrs_dir := $(DESTDIR)$(prefix)/$(target_alias)/include/machine
89install_libs_dir  = $(DESTDIR)$(prefix)/$(target_alias)/lib${MULTISUBDIR}
90
91#-------------------------------------------------------------------------
92# Programs and flags
93#-------------------------------------------------------------------------
94
95# C compiler
96
97CC            := @CC@
98CFLAGS        := @CFLAGS@
99CPPFLAGS      := -I$(obj_dir) -I$(src_dir)
100COMPILE       := $(CC) -MMD -MP $(CPPFLAGS) $(CFLAGS)
101
102# Library creation
103
104AR            := @AR@
105RANLIB        := @RANLIB@
106
107# Installation
108
109INSTALL       := @INSTALL@
110INSTALL_DATA  := @INSTALL_DATA@
111
112#-------------------------------------------------------------------------
113# Build Object Files from C Source
114#-------------------------------------------------------------------------
115
116gloss_c_srcs = $(filter %.c, $(gloss_srcs))
117gloss_c_objs = $(patsubst %.c, %.o, $(notdir $(gloss_c_srcs)))
118gloss_c_deps = $(patsubst %.c, %.d, $(notdir $(gloss_c_srcs)))
119
120$(gloss_c_objs) : %.o : %.c
121        $(COMPILE) -c $<
122
123gloss_objs += $(gloss_c_objs)
124deps += $(gloss_c_deps)
125junk += $(gloss_c_deps) $(gloss_c_objs)
126
127sim_c_objs = $(patsubst %.c, sim-%.o, $(notdir $(gloss_c_srcs)))
128sim_c_deps = $(patsubst %.c, sim-%.d, $(notdir $(gloss_c_srcs)))
129
130$(sim_c_objs): sim-%.o : %.c
131        $(COMPILE) -c -DUSING_SIM_SPECS -o $@ $<
132
133sim_objs += $(sim_c_objs)
134deps += $(sim_c_deps)
135junk += $(sim_c_deps) $(sim_c_objs)
136
137#-------------------------------------------------------------------------
138# Build Object Files from Assembly Source
139#-------------------------------------------------------------------------
140
141gloss_asm_srcs = $(filter %.S, $(gloss_srcs))
142gloss_asm_objs = $(patsubst %.S, %.o, $(notdir $(gloss_asm_srcs)))
143gloss_asm_deps = $(patsubst %.S, %.d, $(notdir $(gloss_asm_srcs)))
144
145$(gloss_asm_objs) : %.o : %.S
146        $(COMPILE) -c -o $@ $<
147
148gloss_objs += $(gloss_asm_objs)
149deps += $(gloss_asm_deps)
150junk += $(gloss_asm_deps) $(gloss_asm_objs)
151
152sim_asm_objs = $(patsubst %.S, sim-%.o, $(notdir $(gloss_asm_srcs)))
153sim_asm_deps = $(patsubst %.S, sim-%.d, $(notdir $(gloss_asm_srcs)))
154
155$(sim_asm_objs) : sim-%.o : %.S
156        $(COMPILE) -c -DUSING_SIM_SPECS -o $@ $<
157
158sim_objs += $(sim_asm_objs)
159deps += $(sim_asm_deps)
160junk += $(sim_asm_deps) $(sim_asm_objs)
161
162#-------------------------------------------------------------------------
163# Build libgloss.a
164#-------------------------------------------------------------------------
165
166gloss_lib  = libgloss.a
167$(gloss_lib) : $(gloss_objs)
168        $(AR) rcv $@ $^
169        $(RANLIB) $@
170
171junk += $(gloss_lib)
172
173install_hdrs += $(gloss_hdrs)
174install_libs += $(gloss_lib)
175install_specs += $(gloss_specs)
176
177#-------------------------------------------------------------------------
178# Build libsim.a
179#-------------------------------------------------------------------------
180
181sim_lib  = libsim.a
182$(sim_lib) : $(sim_objs)
183        $(AR) rcv $@ $^
184        $(RANLIB) $@
185
186junk += $(sim_lib)
187
188install_libs += $(sim_lib)
189
190#-------------------------------------------------------------------------
191# Build crt0.o
192#-------------------------------------------------------------------------
193
194crt0_obj  = $(patsubst %.S, %.o, $(crt0_asm))
195crt0_deps = $(patsubst %.S, %.d, $(crt0_asm))
196
197$(crt0_obj) : %.o : %.S
198        $(COMPILE) -c $<
199
200deps += $(crt0_deps)
201junk += $(crt0_deps) $(crt0_obj)
202
203install_libs += $(crt0_obj)
204
205#-------------------------------------------------------------------------
206# Autodependency files
207#-------------------------------------------------------------------------
208
209-include $(deps)
210
211deps : $(deps)
212.PHONY : deps
213
214#-------------------------------------------------------------------------
215# Installation
216#-------------------------------------------------------------------------
217
218install_hdrs_wdir += $(addprefix $(src_dir)/, $(install_hdrs))
219install-hdrs : $(install_hdrs_wdir)
220        test -d $(install_hdrs_dir) || mkdir -p $(install_hdrs_dir)
221        for file in $^; do \
222                $(INSTALL_DATA) $$file $(install_hdrs_dir)/; \
223        done
224
225install-libs : $(install_libs)
226        test -d $(install_libs_dir) || mkdir -p $(install_libs_dir)
227        for file in $^; do \
228                $(INSTALL_DATA) $$file $(install_libs_dir)/$$file; \
229        done
230
231install-specs : $(install_specs)
232        test -d $(install_libs_dir) || mkdir -p $(install_libs_dir)
233        for file in $^; do \
234                $(INSTALL_DATA) $$file $(install_libs_dir)/; \
235        done
236
237install : install-hdrs install-libs install-specs
238.PHONY : install install-hdrs install-libs
239
240#-------------------------------------------------------------------------
241# Regenerate configure information
242#-------------------------------------------------------------------------
243
244configure_prereq = \
245  $(src_dir)/configure.in \
246
247$(src_dir)/configure : $(configure_prereq)
248        cd $(src_dir) && autoconf
249
250config.status : $(src_dir)/configure
251        ./config.status --recheck
252
253Makefile : $(src_dir)/Makefile.in config.status
254        ./config.status
255
256dist_junk += config.status Makefile config.log
257
258#-------------------------------------------------------------------------
259# Default
260#-------------------------------------------------------------------------
261
262all : $(install_libs)
263.PHONY : all
264
265#-------------------------------------------------------------------------
266# Clean up junk
267#-------------------------------------------------------------------------
268
269clean :
270        rm -rf *~ \#* $(junk)
271
272distclean :
273        rm -rf *~ \#* $(junk) $(dist_junk)
274
275.PHONY : clean distclean
Note: See TracBrowser for help on using the repository browser.