mirror of
https://github.com/tomasriveral/NoteWrapper.git
synced 2026-08-12 02:18:38 +02:00
Reworked configuration.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
CONFIG_DIR := $(HOME)/.config/notewrapper
|
||||
CONFIG_FILE := $(CONFIG_DIR)/config.json
|
||||
CC = gcc
|
||||
SRC = startup.c
|
||||
TARGET = notewrapper
|
||||
@@ -7,11 +9,26 @@ DEBUG ?= 0
|
||||
ifeq ($(DEBUG),1)
|
||||
CFLAGS += -g
|
||||
endif
|
||||
.PHONY: all clean run
|
||||
all: $(TARGET)
|
||||
.PHONY: all clean run install_config
|
||||
|
||||
# existing targets
|
||||
all: install_config $(TARGET)
|
||||
|
||||
$(TARGET): $(SRC)
|
||||
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
||||
@$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
||||
|
||||
run: $(TARGET)
|
||||
./$(TARGET)
|
||||
@./$(TARGET)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET)
|
||||
@rm -f $(TARGET)
|
||||
|
||||
# new target for configuration
|
||||
install_config:
|
||||
@mkdir -p $(CONFIG_DIR)
|
||||
@if [ ! -f $(CONFIG_FILE) ]; then \
|
||||
cp ./config.json $(CONFIG_FILE); \
|
||||
echo "config.json installed to $(CONFIG_FILE)"; \
|
||||
else \
|
||||
echo "$(CONFIG_FILE) already exists, skipping installing default config file"; \
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user