~kline/geiger

geiger/Makefile -rw-r--r-- 541 bytes
e8d948bdGareth Pulham Make it an LD_PRELOADable library with demo 1 year, 11 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
CC = gcc
CFLAGS = -std=c99 -Wall -D_POSIX_C_SOURCE=200809L -fPIC
LDFLAGS = -lpthread -lasound -shared
SOURCES = $(wildcard *.c)
OBJECTS = $(SOURCES:.c=.o)
EXECUTABLE = geiger.so

all: $(EXECUTABLE) demo_target/demo

%.o: %.c %.h
	$(CC) -c $(CFLAGS) $< -o $@

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@

demo_target/demo: demo_target/main.c $(EXECUTABLE)
	gcc -std=c11 $< -o $@

rundemo: demo_target/demo
	LD_PRELOAD=./geiger.so demo_target/demo

.PHONY: clean all rundemo
clean:
	rm -f *.o $(EXECUTABLE) demo_target/demo