Files
websrv/Makefile.ps5

66 lines
1.9 KiB
Makefile

# Copyright (C) 2024 John Törnblom
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not see
# <http://www.gnu.org/licenses/>.
PS5_HOST ?= ps5
PS5_PORT ?= 9021
ifdef PS5_PAYLOAD_SDK
include $(PS5_PAYLOAD_SDK)/toolchain/prospero.mk
else
$(error PS5_PAYLOAD_SDK is undefined)
endif
VERSION_TAG := $(shell git describe --abbrev=10 --dirty --always --tags)
PYTHON ?= python3
BIN := websrv-ps5.elf
SRCS := src/main.c src/websrv.c src/asset.c src/fs.c src/mime.c
SRCS += src/ssdp.c src/proxy.c src/mdns.c src/smb.c
SRCS += src/ps5/sys.c src/ps5/pt.c src/ps5/elfldr.c src/ps5/hbldr.c
SRCS += src/ps5/notify.c src/ps5/http.c
CFLAGS := -g -O2 -Wall -Werror -Isrc -DVERSION_TAG=\"$(VERSION_TAG)\"
CFLAGS += -DHAVE_MDNS -DHAVE_SMB
LDADD := -lkernel_sys -lSceSystemService -lSceUserService -lSceAppInstUtil
LDADD += -lSceSsl -lSceHttp
LDADD += `$(PS5_PAYLOAD_SDK)/bin/prospero-pkg-config libmicrohttpd --libs`
LDADD += `$(PS5_PAYLOAD_SDK)/bin/prospero-pkg-config microdns --libs`
LDADD += `$(PS5_PAYLOAD_SDK)/bin/prospero-pkg-config libsmb2 --libs`
ASSETS := $(wildcard assets/*)
GEN_SRCS := $(patsubst assets/%,gen/%, $(ASSETS:=.c))
all: $(BIN)
gen:
mkdir gen
clean:
rm -rf $(BIN) gen
gen/%.c: assets/% gen
$(PYTHON) gen-asset-module.py --path $* $< > $@
$(BIN): $(SRCS) $(GEN_SRCS)
$(CC) $(CFLAGS) -o $@ $^ $(LDADD)
test: $(BIN)
$(PS5_DEPLOY) -h $(PS5_HOST) -p $(PS5_PORT) $^