-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
41 lines (31 loc) · 873 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
# Build commands
MAKEDIR = @mkdir -p $(@D)
# BUild directories
BUILD_DIR := ./build
OBJ_DIR := $(BUILD_DIR)/obj
BIN_DIR := $(BUILD_DIR)/bin
# Targets
TARGET_BIN := $(BIN_DIR)/mscTools
CSOURCES := $(shell find ./src/ -name '*.c')
COBJS := $(addprefix $(OBJ_DIR)/,$(CSOURCES:%.c=%.o))
# Compiler flags
CF_ALL := -Wall -O0 -g3 -Iinc \
$(shell pkg-config --cflags glib-2.0) \
$(shell pkg-config --cflags popt)
LF_ALL :=
LL_ALL := $(shell pkg-config --libs glib-2.0) \
$(shell pkg-config --libs popt)
# Misc
GIT_ID = $(shell git rev-parse HEAD)
# Local commands
$(OBJ_DIR)/%/Version.o: CF_TGT = -DVERSION_STRING='"$(GIT_ID)"'
$(TARGET_BIN): $(COBJS)
$(MAKEDIR)
$(CC) $(LF_ALL) $^ $(LL_ALL) -o $@
$(OBJ_DIR)/%.o: %.c
@$(MAKEDIR)
$(CC) $(CF_ALL) $(CF_TGT) -c $< -o $@
.PHONY: clean
clean:
rm -f $(COBJS)
rm -f $(TARGET_BIN)