PROG = skeletond

CFLAGS = -c -g -Wall -Wstrict-prototypes

LDFLAGS = -g -pthread

SRCS = \
	already_running.c \
	daemonize.c \
	lockfile.c \
	main.c

OBJS = $(subst .c,.o,$(SRCS))

HDRS = \
	already_running.h \
	daemonize.h \
	lockfile.h


.PHONY: default
default: $(PROG)

$(PROG): $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $^

$(OBJS): $(HDRS)

#skeletond: main.o already_running.o lockfile.o libapue.a
#	$(CC) $(LDFLAGS) -o $@ $^

.PHONY: clean
clean:
	rm -f *~ core $(OBJS)

.PHONY: immaculate
immaculate: clean
	rm -f $(PROGS)

# These can only be updated on the instructor's machine:
#apue_files: ../../../include/sr_2e/apue.h ../../../lib/libapue.a
#	/bin/cp ../../../include/sr_2e/apue.h .
#	/bin/cp ../../../lib/libapue.a .
