forked from lerwys/fcs-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (34 loc) · 880 Bytes
/
Makefile
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
CMDSEP =;
CC = gcc
MAKE = make
CFLAGS = -Wall -Wextra
INCLUDE_DIRS = -I.
LFLAGS = -L.
LDFLAGS = -lbsmp
INSTALL_DIR = /opt/fcs-client
ifeq ($(DEBUG),y)
CFLAGS += -DDEBUG=1
endif
OUT = fcs_client
REVISION=$(shell git describe --dirty --always)
.SECONDEXPANSION:
fcs_client_OBJS = fcs_client.o debug.o revision.o
.PHONY: all clean
all: $(OUT)
$(OUT): $$($$@_OBJS)
$(CC) $(CFLAGS) $(LFLAGS) $(INCLUDE_DIRS) -o $@ $^ $(LDFLAGS)
%.o : %.c %.h
$(CC) $(CFLAGS) $(INCLUDE_DIRS) -c $< -o $@
revision.o: revision.c revision.h
$(CC) $(CFLAGS) -DGIT_REVISION=\"$(REVISION)\" -c revision.c
install:
mkdir -p $(INSTALL_DIR)
cp fcs_client $(INSTALL_DIR)
ln -sf $(INSTALL_DIR)/fcs_client /usr/local/bin/
uninstall:
rm -f $(INSTALL_DIR)/fcs-client
rmdir $(INSTALL_DIR)
rm /usr/local/bin/fcs-client
clean:
$(foreach obj, $($(OUT)_OBJS),rm -f $(obj) $(CMDSEP))
rm -f $(OUT)