Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·90 lines (70 loc) · 1.65 KB
/
Copy pathMakefile
File metadata and controls
executable file
·90 lines (70 loc) · 1.65 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#
#
#
# Makefile template for C code
#
# Author: Gustavo Pantuza Coelho Pinto
# Since: 24.03.2016
#
#
#
# Includes the project configurations
include project.conf
#
# Validating project variables defined in project.conf
#
ifndef PROJECT_NAME
$(error Missing PROJECT_NAME. Put variables at project.conf file)
endif
ifndef BINARY
$(error Missing BINARY. Put variables at project.conf file)
endif
ifndef PROJECT_PATH
$(error Missing PROJECT_PATH. Put variables at project.conf file)
endif
# Gets the Operating system name
OS := $(shell uname -s)
# Default shell
SHELL := bash
# Color prefix for Linux distributions
COLOR_PREFIX := e
ifeq ($(OS),Darwin)
COLOR_PREFIX := 033
endif
# Color definition for print purpose
BROWN=\$(COLOR_PREFIX)[0;33m
BLUE=\$(COLOR_PREFIX)[1;34m
END_COLOR=\$(COLOR_PREFIX)[0m
# Source code directory structure
#BINDIR := bin
SRCDIR := src
OBJDIR := obj
LIBDIR := include
#LOGDIR := log
#TESTDIR := test
# Source code file extension
SRCEXT := c
# Defines the C compiler
CC := gcc
CFLAGS := -no-pie
# Dependency libraries
LIBS := lib/libportaudio.a -lrt -lasound -lpthread -lm -ljack
# %.o file names
NAMES := $(notdir $(basename $(wildcard $(SRCDIR)/*.$(SRCEXT))))
OBJECTS :=$(patsubst %,$(OBJDIR)/%.o,$(NAMES))
default: all
recompile: clean all
# Linking rules and binary file generation
all: $(OBJECTS)
@echo -en "$(BROWN)LD $(END_COLOR)";
$(CC) -o $(BINARY) $+ $(CFLAGS) $(LIBS)
#.o: %.c
# gcc -c $(LIBS) $<
# Rules for object binaries compilation
$(OBJDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@echo -en "$(BROWN)CC $(END_COLOR)";
$(CC) -c $^ -o $@
# clean recorded sessions and objects
clean:
rm -rvf check_output check_input
rm -rvf $(OBJDIR)/*