Fix makefile dependency, again
I guess I have no idea how to write makefile.
This commit is contained in:
parent
0d6b1627f2
commit
a8e29b92c9
12
Makefile
12
Makefile
|
@ -136,13 +136,13 @@ src/.clang_complete: Makefile
|
||||||
.deps:
|
.deps:
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
%.o: src/%.c | .deps
|
.deps/%.d: src/%.c | .deps
|
||||||
$(eval DEP=$(addprefix .deps/,$(@:.o=.d)))
|
@set -e; rm -f $@; \
|
||||||
@set -e; rm -f $(DEP); \
|
|
||||||
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
|
||||||
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $(DEP); \
|
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
||||||
rm -f $@.$$$$
|
rm -f $@.$$$$
|
||||||
$(CC) $(CFG) $(CPPFLAGS) $(INCS) -c src/$*.c
|
%.o: src/%.c
|
||||||
|
$(CC) $(CFG) $(CPPFLAGS) $(INCS) -c src/$*.c -o $@
|
||||||
|
|
||||||
compton: $(OBJS)
|
compton: $(OBJS)
|
||||||
$(CC) $(CFG) $(CPPFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
$(CC) $(CFG) $(CPPFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||||
|
@ -189,4 +189,4 @@ version:
|
||||||
@echo "$(COMPTON_VERSION)"
|
@echo "$(COMPTON_VERSION)"
|
||||||
|
|
||||||
.PHONY: uninstall clean docs version
|
.PHONY: uninstall clean docs version
|
||||||
include $(addprefix .deps/,$(sources:.c=.d))
|
include $(addprefix .deps/,$(OBJS:.o=.d))
|
||||||
|
|
Loading…
Reference in New Issue