Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2f2ae57

Browse files
committed
Track build dependency properly
1 parent 5e341ac commit 2f2ae57

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.o
2+
*.o.d
23
jvm
34
tests/*.out
45
tests/*.class

‎Makefile‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@ CC ?= gcc
22
CFLAGS = -std=c99 -Os -Wall -Wextra
33

44
BIN = jvm
5-
OBJ = jvm.o stack.o
5+
OBJS = jvm.o stack.o
6+
7+
deps := $(OBJS:%.o=.%.o.d)
68

79
include mk/common.mk
810
include mk/jdk.mk
911

1012
# Build PitifulVM
1113
all: $(BIN)
12-
$(BIN): $(OBJ)
13-
$(VECHO) " CC+LD\t\t$@\n"
14+
$(BIN): $(OBJS)
15+
$(VECHO) " CC+LD\t$@\n"
1416
$(Q)$(CC) -o $@ $^
1517

1618
%.o: %.c
17-
$(Q)$(CC) $(CFLAGS) -c $<
19+
$(VECHO) " CC\t$@\n"
20+
$(Q)$(CC) $(CFLAGS) -c -MMD -MF .$@.d $<
1821

1922
TESTS = \
2023
Factorial \
@@ -66,10 +69,12 @@ tests/%-leak.out: tests/%.class jvm
6669
else $(PRINTF) FAILED $$name. Aborting.; false; fi
6770

6871
clean:
69-
$(Q)$(RM) *.o jvm tests/*.out tests/*.class $(REDIR)
72+
$(Q)$(RM) $(OBJS)$(deps)*~ jvm tests/*.out tests/*.class $(REDIR)
7073

7174
.PRECIOUS: %.o tests/%.class tests/%-expected.out tests/%-actual.out tests/%-result.out tests/%-leak.out
7275

7376
indent:
7477
clang-format -i *.c *.h
7578
cloc jvm.c
79+
80+
-include $(deps)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /