CC = gcc
CFLAGS = -std=c99 -pedantic -Wall -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_POSIX_C_SOURCE=200809L -g -c
TARGET_1 = generator
TARGET_2 = supervisor

all: $(TARGET_1).c $(TARGET_2).c
	$(CC) $(CFLAGS) $(TARGET_1).c $(TARGET_2).c
	$(CC) $(TARGET_1).o -o $(TARGET_1) -lrt -lpthread
	$(CC) $(TARGET_2).o -o $(TARGET_2) -lrt -lpthread

generator: $(TARGET_1).c
	$(CC) $(CFLAGS) $(TARGET_1).c
	$(CC) $(TARGET_1).o -o $(TARGET_1) -lrt -lpthread

supervisor: $(TARGET_2).c
	$(CC) $(CFLAGS) $(TARGET_2).c
	$(CC) $(TARGET_2).o -o $(TARGET_2) -lrt -lpthread

install:
	cp $(TARGET_1) /usr/local/bin/graph-$(TARGET_1)
	cp $(TARGET_2) /usr/local/bin/graph-$(TARGET_2)

clean:
	$(RM) $(TARGET_1)
	$(RM) $(TARGET_2)
	$(RM) *.o
	$(RM) *.tgz

package:
	tar -cvzf fb_arc_set.tgz $(TARGET_1).c $(TARGET_2).c Makefile