# Makefile for network emulator CC = gcc CFLAGS = -Os -std=c99 -Wall -Wextra -D_ISOC99_SOURCE INCLUDES = -I. SRCS = net_emulator.c u_async.c timeout_heap.c OBJS = $(SRCS:.c=.o) TARGET = net_emulator all: $(TARGET) $(TARGET): $(OBJS) $(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ test: test_timeout_heap test_uasync_random ./test_timeout_heap ./test_uasync_random test_timeout_heap: test_timeout_heap.o timeout_heap.o $(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ test_uasync_random: test_uasync_random.o u_async.o timeout_heap.o $(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ %.o: %.c $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ clean: rm -f $(OBJS) $(TARGET) test_timeout_heap.o timeout_heap.o test_timeout_heap \ test_uasync_random.o test_uasync_random .PHONY: all clean test