-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·65 lines (50 loc) · 1.15 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
CC:= gcc
CFLAGS:= -Wall -O3 -std=c99 -pedantic -Wno-unused-result
LIBS:= -lm
MKDIR:= mkdir -p
RMDIR:= rm -rf
RM:= rm -f
BINDIR:= bin
SRCDIR:= src
INCDIR:= include
OBJDIR:= obj
DOCDIR:= doc
BGMDIR:= bgm
BIN:= Rpg
SRC:= $(wildcard $(SRCDIR)/*.c)
OBJ:= $(patsubst $(SRCDIR)/%.c,$(OBJDIR)/%.o,$(SRC))
INC:= -I$(INCDIR)
TAR:= $(BIN).tar.gz
.PHONY: dump tar count clean distclean tarclean pull push amend
all: $(BINDIR)/$(BIN)
$(BINDIR)/$(BIN): $(OBJ) | $(BINDIR)
$(CC) $^ $(LIBS) -o $@
@echo "Generating C binary \033[1;32m"$@"\033[0m"
$(OBJ): | $(OBJDIR)
$(OBJDIR)/%.o: $(SRCDIR)/%.c
$(CC) $(CFLAGS) $(INC) -c $< -o $@
$(OBJDIR) $(BINDIR):
$(MKDIR) $@
dump:
@echo "src:" $(SRC)
@echo "obj:" $(OBJ)
tar:
$(MKDIR) $(BIN)/
cp -r $(INCDIR)/ $(SRCDIR)/ $(DOCDIR)/ $(BGMDIR)/ Makefile *.md $(BIN)/
tar -czf $(TAR) $(BIN)/
$(RMDIR) $(BIN)/
@echo "Arquivo\033[1;32m" $(TAR) "\033[0mcriado com sucesso"
count:
wc -l $(SRCDIR)/* $(INCDIR)/*
clean:
$(RMDIR) $(OBJDIR)/
distclean: clean
$(RMDIR) $(BINDIR)/
tarclean:
$(RM) $(TAR)
pull:
git pull origin master
push:
git add . && git commit -m "$(M)" && git push
amend:
git add . && git commit --amend && git push -f