Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Add compiler-generated Makefile dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
luser committed Jun 13, 2014
1 parent f2a64fb commit 1054481
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ busybox-armv6l*
*.swp
*.log
*~

.deps/
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ include Makefile.common
$(AGENT): $(OBJS)
$(LD) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)

%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
$(OBJS): .deps/dir
.deps/dir:
mkdir -p .deps
touch $@

%.o: %.cpp
$(CC) $(CFLAGS) $(CPPFLAGS) -MD -MP -MF .deps/$(@F).pp -c $< -o $@

deps = $(addprefix .deps/,$(addsuffix .pp,$(notdir $(OBJS))))

-include $(deps)
2 changes: 1 addition & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ AGENT = agent$(EXE)
all: $(AGENT)

clean:
rm -f src/*$(OBJ) $(AGENT)
rm -rf src/*$(OBJ) $(AGENT) .deps

0 comments on commit 1054481

Please sign in to comment.