blob: 648de69ae507cfd926ccbcf2a7c5dbed3b3a7e17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#
# Makefile fragment for the user components of the system.
#
# THIS IS NOT A COMPLETE Makefile - run GNU make in the top-level
# directory, and this will be pulled in automatically.
#
SUBDIRS += user
###################
# FILES SECTION #
###################
# order here must match the order of program names in the
# 'user_e' enum defined in include/userids.h!!!
USER_SRC := user/init.c user/idle.c user/shell.c \
user/progABC.c user/progDE.c user/progFG.c user/progH.c \
user/progI.c user/progJ.c user/progKL.c user/progMN.c \
user/progP.c user/progQ.c user/progR.c user/progS.c \
user/progTUV.c user/progW.c user/progX.c user/progY.c \
user/progZ.c
USER_OBJ := $(patsubst %.c, $(BUILDDIR)/%.o, $(USER_SRC))
USER_BIN := $(basename $(USER_SRC))
USER_BIN := $(addprefix $(BUILDDIR)/, $(USER_BIN))
ULDFLAGS := -T user/user.ld
ULIBS := -luser -lcommon
###################
# RULES SECTION #
###################
userland: $(USER_BIN)
$(BUILDDIR)/user/%.o: user/%.c $(BUILDDIR)/.vars.CFLAGS
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILDDIR)/user/%: $(BUILDDIR)/user/%.o
@mkdir -p $(@D)
$(LD) $(ULDFLAGS) $(LDFLAGS) -o $@ $@.o $(ULIBS)
$(OBJDUMP) -S $@ > $@.asm
$(NM) -n $@ > $@.sym
$(READELF) -a $@ > $@.info
#
# Remake the "user blob". When this happens, we also generate a new
# version of the userids.h header file; we don't copy it over the
# previous version if it is the same, to avoid triggering remakes
# of the rest of the system.
#
user.img: $(USR_BIN) mkblob
./mkblob $(USER_BIN)
@./listblob -e $@ > $(BUILDDIR)/new_userids.h
-@sh -c 'cmp -s include/userids.h $(BUILDDIR)/new_userids.h || \
(cp $(BUILDDIR)/new_userids.h include/userids.h; \
echo "\n*** NOTE - updated include/userids.h, rebuild\!" ; \
rm -f $(BUILDDIR)/new_userids.h)'
# some debugging assist rules
user.hex: user.img
hexdump -C $< > $@
|