summaryrefslogtreecommitdiff
path: root/src/GNUmakefile
blob: a5f03059884f837dd97670bbcafc5a24a268b26e (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
.PHONY: all clean install

all: biruda

CFLAGS = -g -std=c99 -Wall -pedantic
LDFLAGS =
LIBS = -lconfuse -lpthread -lnanomsg -ljson-c

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

biruda: biruda.o biruda_cmdline.o master.o coordinator.o worker.o
	$(CC) -o $@ $(LDFLAGS) $^ $(LIBS)

biruda_cmdline.o: biruda_cmdline.c
biruda.o: biruda.c biruda_cmdline.h master.h coordinator.h worker.h sleep.h
master.o: master.c master.h sleep.h
coordinator.o: coordinator.c coordinator.h sleep.h
worker.o: worker.c worker.h sleep.h

biruda_cmdline.c: biruda.ggo
	gengetopt -F biruda_cmdline --unamed-opts --conf-parser --include-getopt -i $<

biruda_cmdline.h: biruda.ggo
	gengetopt -F biruda_cmdline --unamed-opts --conf-parser --include-getopt -i $<

clean:
	@-rm *.o
	@-rm biruda
	@-rm biruda_cmdline.[ch]

# default values
DESTDIR ?=
prefix ?= /usr

# standard directories following FHS
execdir=$(prefix)
sbindir=$(execdir)/sbin
sysconfdir=$(execdir)/etc
	
install:
	@test -d $(DESTDIR)$(sbindir) || install -d -m 0755 $(DESTDIR)$(sbindir)
	install -m 0775 biruda $(DESTDIR)$(sbindir)
	@test -d $(DESTDIR)$(sysconfdir)/biruda || install -d -m 0755 $(DESTDIR)$(sysconfdir)/biruda
	install -m 0644 biruda.conf $(DESTDIR)$(sysconfdir)/biruda