mirror of
https://github.com/cyring/CoreFreq.git
synced 2025-07-23 04:12:59 +02:00
[Build] Enforce targets are not built more than necessary
This commit is contained in:
19
Makefile
19
Makefile
@@ -139,15 +139,14 @@ $(error Target 'clean' must be run alone: See 'make help')
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(filter prepare,$(MAKECMDGOALS)),)
|
ifneq ($(filter $(BUILD)/.prepare-stamp,$(MAKECMDGOALS)),)
|
||||||
$(error Target 'prepare' is internal. See 'make help')
|
$(error Target '$(BUILD)/.prepare-stamp' is internal. See 'make help')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: prepare corefreqd corefreq-cli corefreqk.ko | prepare
|
all: $(BUILD)/.prepare-stamp corefreqd corefreq-cli corefreqk.ko | $(BUILD)/.prepare-stamp
|
||||||
|
|
||||||
.PHONY: prepare
|
$(BUILD)/.prepare-stamp:
|
||||||
prepare:
|
|
||||||
@if [ ! -d $(BUILD) ]; then \
|
@if [ ! -d $(BUILD) ]; then \
|
||||||
if [ ${SILENT} -eq 0 ]; then \
|
if [ ${SILENT} -eq 0 ]; then \
|
||||||
echo " MD [$(BUILD)]"; \
|
echo " MD [$(BUILD)]"; \
|
||||||
@@ -175,9 +174,10 @@ prepare:
|
|||||||
fi; \
|
fi; \
|
||||||
$(SYMLINK) ../../$(HW)/corefreqk.c corefreqk.c; \
|
$(SYMLINK) ../../$(HW)/corefreqk.c corefreqk.c; \
|
||||||
cd ../..; \
|
cd ../..; \
|
||||||
fi
|
fi; \
|
||||||
|
touch $@
|
||||||
|
|
||||||
$(BUILD)/corefreqk.ko: prepare
|
$(BUILD)/corefreqk.ko: $(BUILD)/.prepare-stamp
|
||||||
@if [ -e $(BUILD)/Makefile ]; then \
|
@if [ -e $(BUILD)/Makefile ]; then \
|
||||||
if [ -z ${V} ]; then \
|
if [ -z ${V} ]; then \
|
||||||
$(MAKE) --no-print-directory -C $(KERNELDIR) \
|
$(MAKE) --no-print-directory -C $(KERNELDIR) \
|
||||||
@@ -281,6 +281,7 @@ clean:
|
|||||||
$(RMDIR) $(BUILD)/module; \
|
$(RMDIR) $(BUILD)/module; \
|
||||||
fi; \
|
fi; \
|
||||||
if [ -d $(BUILD) ] && [ -z "$(ls -A $(BUILD))" ]; then \
|
if [ -d $(BUILD) ] && [ -z "$(ls -A $(BUILD))" ]; then \
|
||||||
|
$(RM) $(BUILD)/.prepare-stamp; \
|
||||||
if [ ${SILENT} -eq 0 ]; then echo " RD [$(BUILD)]"; fi; \
|
if [ ${SILENT} -eq 0 ]; then echo " RD [$(BUILD)]"; fi; \
|
||||||
$(RMDIR) $(BUILD); \
|
$(RMDIR) $(BUILD); \
|
||||||
fi
|
fi
|
||||||
@@ -295,7 +296,7 @@ $(BUILD)/corefreqd.o: $(HW)/corefreqd.c
|
|||||||
$(CC)) $(OPTIM_FLG) $(WARNING) -pthread $(DEFINITIONS) \
|
$(CC)) $(OPTIM_FLG) $(WARNING) -pthread $(DEFINITIONS) \
|
||||||
-c $(HW)/corefreqd.c -o $(BUILD)/corefreqd.o
|
-c $(HW)/corefreqd.c -o $(BUILD)/corefreqd.o
|
||||||
|
|
||||||
$(BUILD)/corefreqd: prepare $(BUILD)/corefreqd.o $(BUILD)/corefreqm.o
|
$(BUILD)/corefreqd: $(BUILD)/.prepare-stamp $(BUILD)/corefreqd.o $(BUILD)/corefreqm.o
|
||||||
$(if $(V), $(CC), @if [ ${SILENT} -eq 0 ]; then echo " LD [$@]"; fi; \
|
$(if $(V), $(CC), @if [ ${SILENT} -eq 0 ]; then echo " LD [$@]"; fi; \
|
||||||
$(CC)) $(OPTIM_FLG) -o $(BUILD)/corefreqd \
|
$(CC)) $(OPTIM_FLG) -o $(BUILD)/corefreqd \
|
||||||
$(BUILD)/corefreqd.o $(BUILD)/corefreqm.o -lpthread -lm -lrt -lc
|
$(BUILD)/corefreqd.o $(BUILD)/corefreqm.o -lpthread -lm -lrt -lc
|
||||||
@@ -328,7 +329,7 @@ $(BUILD)/corefreq-cli-extra.o: $(HW)/corefreq-cli-extra.c
|
|||||||
$(CC)) $(OPTIM_FLG) $(WARNING) $(DEFINITIONS) \
|
$(CC)) $(OPTIM_FLG) $(WARNING) $(DEFINITIONS) \
|
||||||
-c $(HW)/corefreq-cli-extra.c -o $(BUILD)/corefreq-cli-extra.o
|
-c $(HW)/corefreq-cli-extra.c -o $(BUILD)/corefreq-cli-extra.o
|
||||||
|
|
||||||
$(BUILD)/corefreq-cli: prepare \
|
$(BUILD)/corefreq-cli: $(BUILD)/.prepare-stamp \
|
||||||
$(BUILD)/corefreq-cli.o \
|
$(BUILD)/corefreq-cli.o \
|
||||||
$(BUILD)/corefreq-ui.o \
|
$(BUILD)/corefreq-ui.o \
|
||||||
$(BUILD)/corefreq-cli-rsc.o \
|
$(BUILD)/corefreq-cli-rsc.o \
|
||||||
|
Reference in New Issue
Block a user