asfur/Makefile
Lorenzo Torres 238eff5bb3 Add unit test suite and complete protocol documentation
- Add test framework (test.h) with assertion macros and test runner
- Add comprehensive unit tests (test_network.c) covering:
  - Packet parsing and error handling
  - User registration and authentication
  - Room operations (create, join, leave, delete, list)
  - Direct messaging functionality
  - Message broadcasting
  - Password hashing
- Update Makefile with 'make test' target
- Rewrite PROTOCOL file with complete specification:
  - All 14 packet types with data layouts
  - All error codes with descriptions
  - Typical usage flows
2026-01-08 15:51:01 +01:00

65 lines
1.5 KiB
Makefile

# See LICENSE file for copyright and license details.
include config.mk
SRC = main.c\
password.c\
network.c
HDR = config.def.h client.h password.h network.h
OBJ = ${SRC:.c=.o}
all: options asfur
options:
@echo asfur build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
.c.o:
${CC} -c ${CFLAGS} $<
${OBJ}: config.h client.h password.h network.h
config.h:
cp config.def.h $@
users.h:
cp users.def.h $@
asfur: ${OBJ}
${CC} -o $@ ${OBJ} ${LDFLAGS}
test: test_network
./test_network
test_network: test_network.o network.o password.o
${CC} -o $@ test_network.o network.o password.o ${LDFLAGS}
test_network.o: test_network.c test.h network.h client.h password.h
${CC} -c ${CFLAGS} test_network.c
clean:
rm -f asfur test_network ${OBJ} test_network.o asfur-${VERSION}.tar.gz
dist: clean
mkdir -p asfur-${VERSION}
cp -R LICENSE Makefile README config.mk\
asfur.1 ${HDR} ${SRC} asfur-${VERSION}
tar -cf asfur-${VERSION}.tar asfur-${VERSION}
gzip asfur-${VERSION}.tar
rm -rf asfur-${VERSION}
install: all
mkdir -p ${DESTDIR}${PREFIX}/bin
cp -f asfur ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/asfur
mkdir -p ${DESTDIR}${MANPREFIX}/man1
sed "s/VERSION/${VERSION}/g" < asfur.1 > ${DESTDIR}${MANPREFIX}/man1/asfur.1
chmod 644 ${DESTDIR}${MANPREFIX}/man1/asfur.1
uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/asfur\
${DESTDIR}${MANPREFIX}/man1/asfur.1
.PHONY: all options clean dist install uninstall test