-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
32 lines (25 loc) · 835 Bytes
/
Makefile
File metadata and controls
32 lines (25 loc) · 835 Bytes
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
IDIR = include
BUILD = build
# we want to place all objects in object directory.
OBJS = $(addprefix $(BUILD)/, shellcmds.o sim.o isa_helper.o isa.o)
CC = clang
override CFLAGS += -O2 -std=c99 -I $(IDIR)
exec = $(BUILD)/armsh
execobj = $(exec).o
all: $(exec)
$(exec): $(OBJS) $(execobj) | $(BUILD)
$(CC) $(CFLAGS) -o $@ $^
# compile the C-file in main directory to object in BUILD
# the | does some magic so this does not care about timestamp of BUILD
$(OBJS): $(BUILD)/%.o : %.c $(IDIR)/%.h | $(BUILD)
$(CC) -c $(CFLAGS) -o $@ $<
$(execobj): $(BUILD)/%.o : %.c | $(BUILD)
$(CC) -c $(CFLAGS) -o $@ $<
$(BUILD):
mkdir -p $(BUILD)
# because clean and all aren't filenames
.PHONY: clean all
# using -f option to supress file not found errors with rm
# using -r option to recursively delete everything.
clean:
-rm -rf $(BUILD)