aboutsummaryrefslogtreecommitdiff
path: root/threadlib/src/Makefile
blob: fd635c62ae22e86b5224487ad01d4a153848d9d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# -------------------------------------------------
# adjust the next 2 pathes to your system:

# this should point to the directory which contains
# m_pd.h and g_canvas.h
PDSCR=/home/holzi/pd-0.39-1/src

# this is the pd directory, here the files will be
# installed
PDPATH=/usr/lib/pd

# --------------------------------------------------

TARGET=threadlib.pd_linux

OBJ=fifo.o callbacks.o threadlib.o \
    sleep.o detach.o join.o

CC = gcc
LD = gcc
INCLUDE=-I$(PDSCR) -I.
LIB=-lc -lm
CC_FLAGS = -DPD -DUNIX -c -fPIC \
           -Wall -Wno-parentheses -Wno-switch -O3 \
           -funroll-loops -fomit-frame-pointer -pthread
LD_FLAGS = --export-dynamic -shared -o

# --------------------------------------------------

all: pd_linux

pd_linux: $(TARGET)

$(TARGET): $(OBJ)
	$(LD) $(LD_FLAGS) $(TARGET) $(OBJ) $(LIB)
	strip --strip-unneeded $(TARGET)
	chmod 755 $(TARGET)

threadlib.o: threadlib.h threadlib.c
	$(CC) $(CC_FLAGS) $(INCLUDE) threadlib.c

fifo.o: threadlib.o fifo.c
	$(CC) $(CC_FLAGS) $(INCLUDE) fifo.c

callbacks.o: fifo.o threadlib.o callbacks.c
	$(CC) $(CC_FLAGS) $(INCLUDE) callbacks.c

sleep.o: threadlib.o sleep.c
	$(CC) $(CC_FLAGS) $(INCLUDE) sleep.c

detach.o: threadlib.o fifo.o detach.c
	$(CC) $(CC_FLAGS) $(INCLUDE) detach.c

join.o: threadlib.o callbacks.o join.c
	$(CC) $(CC_FLAGS) $(INCLUDE) join.c

# --------------------------------------------------

clean:
	rm -f $(OBJ) $(TARGET)

install:
	@test -d $(PDPATH)/extra || mkdir -p $(PDPATH)/extra
	install $(TARGET) $(PDPATH)/extra
	install ../doc/*.pd $(PDPATH)/doc/5.reference