Files
libpollcat/tests/Makefile
Morgan Hughes d0dd5f7a4a More minor bugfixes
- make pollcat_loop() work as expected with no structs linked, by
  - calling usleep() instead of poll()
  - refactoring delay calculation and reset into pollcat_time_value()
- simplify pollcat_timer_dispatch() in case of slow callbacks
  - deprecate pollcat_timer_dispatch_thresh
- revise tests/timer.c to support two new options:
  - -s to monitor stdin with pollcat_fd_add()
  - -w to use pollcat_loop() instead of handling main-loop separately
- make pollcat_dump() always present in header, since it's always compiled in
- add Makefile rules for installing tests, for easier running on cross-compiled targets
2025-09-18 13:28:27 -07:00

79 lines
1.8 KiB
Makefile

# Test stubs Makefile
#
# This file is part of the Pollcat Library.
# Copyright (C) 2022,2025 Expatria Technologies Inc.
# Contact: Morgan Hughes <morgan@expatria.ca>
#
# The Pollcat Library is free software: you can redistribute it and/or modify it under the
# terms of the the GNU Lesser 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 copies of the GNU General Public License and the GNU Lesser
# General Public License along with the Pollcat Library. If not, see
# https://www.gnu.org/licenses/
#
# vim:ts=4:noexpandtab
# Integrators should override these
PREFIX ?= /usr/local
export PREFIX DESTDIR
# output targets
BINS := \
poll \
struct \
timer
# "poll" app
POLL_OBJS := poll.o
POLL_LIBS := -lpollcat
# "struct" app
STRUCT_OBJS := struct.o
STRUCT_LIBS := -lpollcat
# "timer app
TIMER_OBJS := timer.o
TIMER_LIBS := -lpollcat
CFLAGS += -I../include -Wall -Werror -g
CFLAGS += -D_LARGEFILE64_SOURCE
LFLAGS += -L.. -Wl,-rpath=$(shell cd .. && pwd)
.PHONY: all install clean
all: $(BINS)
@echo
poll: $(POLL_OBJS)
$(CC) $(CFLAGS) $(LFLAGS) $^ $(POLL_LIBS) -o $@
struct: $(STRUCT_OBJS)
$(CC) $(CFLAGS) $(LFLAGS) $^ $(STRUCT_LIBS) -o $@
timer: $(TIMER_OBJS)
$(CC) $(CFLAGS) $(LFLAGS) $^ $(TIMER_LIBS) -o $@
install:
mkdir -p $(DESTDIR)$(PREFIX)/bin
install -m755 $(BINS) $(DESTDIR)$(PREFIX)/bin
clean:
rm -f $(POLL_OBJS)
rm -f $(STRUCT_OBJS)
rm -f $(TIMER_OBJS)
rm -f $(BINS)
%.i: %.c
$(CC) $(CFLAGS) -E $< -o $@
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@