Added "help" option to makefile
This commit is contained in:
parent
d18ea48346
commit
0debdf3251
29
Makefile
29
Makefile
@ -1,5 +1,3 @@
|
|||||||
help: ## show help message
|
|
||||||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
OUT_DIR = ./build
|
OUT_DIR = ./build
|
||||||
@ -17,23 +15,21 @@ INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
|||||||
|
|
||||||
CCFLAGS := $(INC_FLAGS)
|
CCFLAGS := $(INC_FLAGS)
|
||||||
|
|
||||||
.PHONY: clean install build
|
.PHONY: build clean install install-services uninstall-services create-services reinstall-services
|
||||||
|
|
||||||
install: build create-services install-services
|
install: build create-services install-services ## Full installation. Builds the proxmon executable, generates service files, installs and starts services
|
||||||
|
|
||||||
build: $(TARGET)
|
build: $(TARGET) create-services ## Build the proxmon executable, and generates service files for editing
|
||||||
|
|
||||||
clean:
|
clean: ## Remove all build artifacts including generated service files (does not uninstall service files)
|
||||||
@rm -rf bin/ $(OUT_DIR) $(SERVICE_DIR)
|
@rm -rf bin/ $(OUT_DIR) $(SERVICE_DIR)
|
||||||
|
|
||||||
./bin:
|
./bin:
|
||||||
@mkdir -p ./bin
|
@mkdir -p ./bin
|
||||||
@cp ./dist/* ./bin
|
@cp ./dist/* ./bin
|
||||||
|
|
||||||
$(OUT_DIR):
|
$(OUT_DIR)/%.o: $(SRC_DIRS)/%.c
|
||||||
@mkdir -p $@
|
@mkdir -p $(dir $@)
|
||||||
|
|
||||||
$(OUT_DIR)/%.o: $(SRC_DIRS)/%.c | $(OUT_DIR)
|
|
||||||
$(CC) $(CCFLAGS) -c $< -o $@
|
$(CC) $(CCFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(TARGET): $(OBJS) | ./bin
|
$(TARGET): $(OBJS) | ./bin
|
||||||
@ -62,14 +58,14 @@ $(SERVICE_DIR):
|
|||||||
$(SERVICE_DIR)/%.service: $(TEMPLATE_DIR)/%.service.in | $(SERVICE_DIR)
|
$(SERVICE_DIR)/%.service: $(TEMPLATE_DIR)/%.service.in | $(SERVICE_DIR)
|
||||||
sed 's|@WORKDIR@|$(WORKDIR)|g' $< > $@
|
sed 's|@WORKDIR@|$(WORKDIR)|g' $< > $@
|
||||||
|
|
||||||
create-services: $(SERVICES)
|
create-services: $(SERVICES) ## Generate service files from templates into the systemd/ directory
|
||||||
|
|
||||||
# install service into systemd
|
# install a service into systemd
|
||||||
$(INSTALL_DIR)/%.service: $(SERVICE_DIR)/%.service
|
$(INSTALL_DIR)/%.service: $(SERVICE_DIR)/%.service
|
||||||
install -m 644 $< $(INSTALL_DIR)/
|
install -m 644 $< $(INSTALL_DIR)/
|
||||||
|
|
||||||
|
|
||||||
install-services: create-services $(INSTALLED)
|
install-services: create-services $(INSTALLED) ## Installs all service files in the systemd/ directory into /etc/systemd/system
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
@for srv in $(SERVICES); do \
|
@for srv in $(SERVICES); do \
|
||||||
name=$$(basename $$srv); \
|
name=$$(basename $$srv); \
|
||||||
@ -77,7 +73,7 @@ install-services: create-services $(INSTALLED)
|
|||||||
systemctl start $$name; \
|
systemctl start $$name; \
|
||||||
done
|
done
|
||||||
|
|
||||||
uninstall-services:
|
uninstall-services: ## Stops and uninstalls all services associated with ProxMon
|
||||||
@for srv in $(INSTALLED); do \
|
@for srv in $(INSTALLED); do \
|
||||||
name=$$(basename $$srv); \
|
name=$$(basename $$srv); \
|
||||||
echo "Stopping and uninstalling $$name..."; \
|
echo "Stopping and uninstalling $$name..."; \
|
||||||
@ -87,4 +83,7 @@ uninstall-services:
|
|||||||
done
|
done
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
||||||
reinstall-services: uninstall-services install-services
|
reinstall-services: uninstall-services install-services ## Uninstalls and reinstalls ProxMon services
|
||||||
|
|
||||||
|
help: ## Show help message
|
||||||
|
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-18s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user