-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.in
133 lines (114 loc) · 3.41 KB
/
Makefile.in
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# SPDX-License-Identifier: GPL-3.0-or-later
#
# @configure_input@
# Copyright (C) 2022 Quico Augustijn
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed "as is" in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. If your
# computer no longer boots, divides by 0 or explodes, you are the only
# one responsible. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# version 3 along with this program. If not, see
# <https://www.gnu.org/licenses/gpl-3.0.html>.
SHELL = /bin/sh
# Variables
NAME = @PACKAGE_NAME@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
VERSION = @PACKAGE_VERSION@
CC = @CC@
EXE_EXT = @EXEEXT@
OBJ_EXT = @OBJEXT@
MKDIR_P = @MKDIR_P@
CFLAGS ?= @CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
PKG_FLAGS += @GLIB_CFLAGS@ @GIO_CFLAGS@ @GOBJECT_CFLAGS@ @GSTREAMER_CFLAGS@
PKG_LIBS += @GLIB_LIBS@ @GIO_LIBS@ @GOBJECT_LIBS@ @GSTREAMER_LIBS@
# Directory variables
builddir = @builddir@
abs_builddir = @abs_builddir@
top_builddir = @top_builddir@
top_build_prefix = @top_build_prefix@
abs_top_builddir = @abs_top_builddir@
srcdir = @srcdir@
abs_srcdir = @abs_srcdir@
top_srcdir = @top_srcdir@
abs_top_srcdir = @abs_top_srcdir@
# Common prefix for installation directories
# (following the Makefile Conventions)
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datarootdir = @datarootdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
runstatedir = @runstatedir@
includedir = @includedir@
docdir = @docdir@
infodir = @infodir@
htmldir = @htmldir@
dvidir = @dvidir@
pdfdir = @pdfdir@
psdir = @psdir@
libdir = @libdir@
localedir = @localedir@
mandir = @mandir@
# Build information
BIN_NAME = $(PACKAGE_TARNAME)$(EXE_EXT)
# Dependencies and targets
PREREQUISITE = main
# Compiler and linker flags
WARN_FLAGS = -Wall -Wextra
INC_FLAGS = -I$(SRC_DIR)
DEBUG_FLAGS = -g -ggdb
# Directories used for compilation
BIN_DIR = bin
OBJ_DIR = obj
SRC_DIR = src
# Final binary target
TARGET_EXEC ?= $(BIN_DIR)/$(BIN_NAME)
# Sources and targets
OBJS := $(PREREQUISITE:%=$(OBJ_DIR)/%.$(OBJ_EXT))
SRCS := $(PREREQUISITE:%=$(SRC_DIR)/%.c)
# Targets that do not generate any files
.PHONY: all clean distclean mostlyclean check
# Default target
all: $(TARGET_EXEC)
# Final binary linkage
$(TARGET_EXEC): $(OBJS)
@$(MKDIR_P) $(@D)
$(CC) -pie -o $@ $^ $(LIBS) $(PKG_LIBS) $(CFLAGS) $(LDFLAGS)
# Object compilation
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@$(MKDIR_P) $(@D)
$(CC) $(INC_FLAGS) -fPIE -c $< -o $@ $(PKG_FLAGS) $(WARN_FLAGS) $(DEBUG_FLAGS) $(CFLAGS) $(CPPFLAGS)
# Clean all compiled files
clean:
@$(MAKE) mostlyclean
-rm -fv $(TARGET_EXEC)
# Clean all generated and compiled files
distclean:
@$(MAKE) clean
-rm -frv autom4te.cache aclocal.m4 config.log config.status Makefile
# Clean temporary files
mostlyclean:
-rm -fv $(OBJ_DIR)/*.i $(OBJ_DIR)/*.s $(OBJ_DIR)/*.o
-rm -fv $(OBJ_DIR)/*/*.i $(OBJ_DIR)/*/*.s $(OBJ_DIR)/*/*.o
# Perform self-tests
check: $(TARGET_EXEC)
./$< --version
# Reconfigure Makefile
Makefile:
./configure