Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
500Foods authored Jul 15, 2024
1 parent dcb1cf8 commit 3243766
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 6 deletions.
40 changes: 34 additions & 6 deletions elements/001-hydrogen/hydrogen/Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,59 @@

CC = gcc
CFLAGS = -std=c17 -Wall -Wextra -pedantic -O2 -D_GNU_SOURCE
LDFLAGS = -ljansson -lpthread -lmicrohttpd -lm -lssl -lcrypto -lwebsockets

SRC_DIR = src
BUILD_DIR = build
DEBUG_DIR = build_debug
VALGRIND_DIR = build_valgrind

SRCS = $(wildcard $(SRC_DIR)/*.c)
OBJS = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SRCS))
DEBUG_OBJS = $(patsubst $(SRC_DIR)/%.c,$(DEBUG_DIR)/%.o,$(SRCS))
VALGRIND_OBJS = $(patsubst $(SRC_DIR)/%.c,$(VALGRIND_DIR)/%.o,$(SRCS))

TARGET = hydrogen
DEBUG_TARGET = hydrogen_debug
VALGRIND_TARGET = hydrogen_valgrind

.PHONY: all clean debug
.PHONY: all clean debug valgrind

all: $(TARGET)

debug: CFLAGS += -g -fsanitize=address -fno-omit-frame-pointer
debug: LDFLAGS += -fsanitize=address
debug: $(TARGET)
debug: $(DEBUG_TARGET)

valgrind: CFLAGS += -g
valgrind: $(VALGRIND_TARGET)

$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

$(DEBUG_TARGET): $(DEBUG_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

$(VALGRIND_TARGET): $(VALGRIND_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c | $(BUILD_DIR)
$(CC) $(CFLAGS) -c -o $@ $<
$(CC) $(CFLAGS) -c -o $@ $<

$(DEBUG_DIR)/%.o: $(SRC_DIR)/%.c | $(DEBUG_DIR)
$(CC) $(CFLAGS) -c -o $@ $<

$(VALGRIND_DIR)/%.o: $(SRC_DIR)/%.c | $(VALGRIND_DIR)
$(CC) $(CFLAGS) -c -o $@ $<

$(BUILD_DIR):
mkdir -p $@
mkdir -p $@

$(DEBUG_DIR):
mkdir -p $@

$(VALGRIND_DIR):
mkdir -p $@

clean:
rm -rf $(BUILD_DIR) $(TARGET)
rm -rf $(BUILD_DIR) $(DEBUG_DIR) $(VALGRIND_DIR) $(TARGET) $(DEBUG_TARGET) $(VALGRIND_TARGET)
37 changes: 37 additions & 0 deletions elements/001-hydrogen/hydrogen/hydrogen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"ServerName": "Philement/hydrogen",
"WebPort": 5000,
"WebsocketPort": 5001,
"WebRoot":"/home/asimard/lithium",
"UploadPath": "/api/upload",
"UploadDir": "/tmp/hydrogen_uploads",
"MaxUploadSize": 2147483648,
"LogFile": "/var/log/hydrogen.log",
"mDNS": {
"DeviceId": "hydrogen-printer",
"FriendlyName": "Hydrogen 3D Printer",
"Model": "Hydrogen",
"Manufacturer": "Philement",
"Version": "0.1.0",
"Services": [
{
"Name": "Hydrogen Web Interface",
"Type": "_http._tcp",
"Port": 5000,
"TxtRecords": "path=/api/upload"
},
{
"Name": "Hydrogen OctoPrint Emulation",
"Type": "_octoprint._tcp",
"Port": 5000,
"TxtRecords": "path=/api,version=1.1.0"
},
{
"Name": "Hydrogen WebSocket",
"Type": "_websocket._tcp",
"Port": 5001,
"TxtRecords": "path=/websocket"
}
]
}
}

0 comments on commit 3243766

Please sign in to comment.