Skip to content

Commit d965ec7

Browse files
committed
Makefile: do not call make recursively inside the install target
Instead of calling make inside the install target to make sure that mbpfan is compiled prior to installing, declare $(BIN) as a prerequisite for the target. This also enables parallel compilation from the install target in addition to avoiding unnecessary re-linking.
1 parent 1ee0e1f commit d965ec7

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ OBJS := $(patsubst %.$(C),%.$(OBJ),$(wildcard $(SOURCE_PATH)*.$(C)))
2525
@echo Compiling $(basename $<)...
2626
$(CC) -c $(CFLAGS) $< $(OBJFLAG)$@
2727

28-
all: $(OBJS)
28+
all: $(BIN)
29+
30+
$(BIN): $(OBJS)
2931
@echo Linking...
3032
$(CC) $(LDFLAGS) $^ $(LIBS) $(BINFLAG) $(BIN)
3133

@@ -43,8 +45,7 @@ uninstall:
4345
rm /usr/share/man/man8/mbpfan.8.gz
4446
rm -rf /usr/share/doc/mbpfan
4547

46-
install:
47-
make
48+
install: $(BIN)
4849
install -d $(DESTDIR)/usr/sbin
4950
install -d $(DESTDIR)/etc
5051
install -d $(DESTDIR)/lib/systemd/system

0 commit comments

Comments
 (0)