blob: eca6a36ede154fffdc16a20379c78fda18e41eaf (
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
46
47
48
49
50
51
52
53
54
55
56
57
|
# Some variables
CC = gcc
RM = rm
CURSES=ncurses
TAG=`if git status >/dev/null 2>&1; then \
echo "git "; \
else \
test -f version && cat version; \
fi`
VERSION=`if git status >/dev/null 2>&1; then \
git log -n 1 --pretty=format:"%h"; \
else \
echo ""; \
fi`
DATE=`if git status >/dev/null 2>&1; then \
echo ", build: "\`date +%x_%Z\`; \
else \
echo ", build: "\`date +%x_%H:%M_%Z\`; \
fi`
# Compilation and link phases options
CFLAGS = -c -g -O2 -Wall -Wextra
LFLAGS = -l$(CURSES)
# The build target
OBJS = smenu.o
TARGET = smenu
# The rules
all: $(TARGET)
.c.o :
@echo "CC " $<
@$(CC) $(CFLAGS) -DVERSION=\""$(TAG)$(VERSION)$(DATE)"\" $<
$(TARGET): $(OBJS)
@echo CCLD $<
@$(CC) -o $@ $(OBJS) $(LFLAGS)
clean:
$(RM) -f $(OBJS) $(TARGET) smenu-*.tar.gz core
strip:
strip $(TARGET)
archive:
@if git status >/dev/null 2>&1; then \
V=$(VERSION); \
if git archive --prefix=smenu-$${V}/ -o smenu-$${V}.tar.gz $${V}; then \
echo "smenu-$${V}.tar.gz written."; \
fi \
else \
echo "This is not a git repository."; \
fi
|