-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (52 loc) · 1.5 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#
# Makefile
# gpack - https://github.com/WestleyR/gpack
#
# Created by WestleyR on Jun 16, 2019
# Source code: https://github.com/WestleyR/gpack
#
# Copyright (c) 2019-2021 WestleyR. All rights reserved.
# This software is licensed under a BSD 3-Clause Clear License.
# Consult the LICENSE file that came with this software regarding
# your rights to distribute this software.
#
# The prefix to install the gpack command. This should
# not be changed, unless you know what your doing.
PREFIX = $(HOME)/.local
# The C compiler
CC = gcc
# These flags can be changed though the command line
CFLAGS = -Wall -Ideps -g
LDFLAGS ?=
TARGET = gpack
MODDED = $(shell if command -v git > /dev/null ; then (git diff --exit-code --quiet && echo \"[No changes]\") || echo \"[With uncommited changes]\" ; else echo \"[unknown]\" ; fi)
COMMIT = "$(shell git log -1 --oneline --decorate=short --no-color || ( echo 'ERROR: unable to get commit hash' >&2 ; echo unknown ) )"
CFLAGS += -DCOMMIT_HASH=\"$(COMMIT)\"
CFLAGS += -DUNCOMMITED_CHANGES=\"$(MODDED)\"
ifeq ($(DEBUG), true)
CFLAGS += -DDEBUG
endif
SRC = $(wildcard src/*.c)
SRC += $(wildcard deps/*/*.c)
OBJS = $(SRC:.c=.o)
.PHONY:
all: $(TARGET)
.PHONY:
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(TARGET)
.PHONY:
%.o: %.c
$(CC) $(DEP_FLAG) $(CFLAGS) $(DEFLAGS) -o $@ -c $< $(LDFLAGS)
.PHONY:
clean:
rm -f $(OBJS)
.PHONY:
cleanall:
rm -f $(TARGET) $(OBJS)
.PHONY:
install: $(TARGET)
mkdir -p $(PREFIX)/bin
cp -f $(TARGET) $(PREFIX)/bin
#
# End Makefile
#