-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (32 loc) 路 978 Bytes
/
Copy pathMakefile
File metadata and controls
41 lines (32 loc) 路 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
CC = gcc
CFLAGS = -Wall -Iinclude
LIBS = -lmosquitto -lsqlite3 -lwebsockets -lpthread
BUILD_DIR = build
TARGET = $(BUILD_DIR)/server
SRC = src/main.c src/mqtt_client.c src/db_handler.c src/websocket_server.c src/react-server.c src/thread_manager.c
GREEN = \033[0;32m
NC = \033[0m
WWW_DIR = www
DASHBOARD_REPO = https://github.com/basilite/dashboard.git
DASHBOARD_DIR = dashboard
$(TARGET): $(SRC)
mkdir -p $(BUILD_DIR)
$(CC) $(SRC) -o $(TARGET) $(CFLAGS) $(LIBS)
@echo -e "$(GREEN)compiled$(NC)"
.PHONY: clean run setup
clean:
rm -rf $(BUILD_DIR) $(WWW_DIR)
run: $(TARGET)
./$(TARGET)
setup:
@if [ ! -d "$(DASHBOARD_DIR)" ]; then \
echo "Cloning dashboard repository..."; \
git clone $(DASHBOARD_REPO); \
else \
echo "Dashboard repository already cloned."; \
fi
cd $(DASHBOARD_DIR) && npm install && npm run build
mkdir -p $(WWW_DIR)
cp -r $(DASHBOARD_DIR)/build/* $(WWW_DIR)/
rm -rf $(DASHBOARD_DIR)
@echo -e "$(GREEN)Dashboard setup complete!$(NC)"