-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·79 lines (56 loc) · 1.8 KB
/
Copy pathMakefile
File metadata and controls
executable file
·79 lines (56 loc) · 1.8 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
#!/usr/bin/make -f
# Plain Text Archive Tool Installation Script
# Written in 2013. See AUTHORS for a list of authors.
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
#
# You should have received a copy of the CC0 Public Domain Dedication along
# with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
# CONFIGURATION VARIABLES
# Feel free to set these at the command line.
# the name of the generated binary
BINFILE ?= ptar
# compilation flags
CFLAGS ?= -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -O2 -g -Wall
CPPFLAGS ?=
# the installation program (install(1))
INSTALL ?= install
# the user and group for the installed binary
INSTALL_USER ?= root
INSTALL_GROUP ?= root
# the installation prefix
PREFIXDIR ?= /usr
# the directory that will hold the installed binary
BINDIR ?= $(PREFIXDIR)/bin
# the name of the ptar archive that the 'dist' target builds
DISTARCHIVE ?= $(BINFILE).ptar
# INTERNAL VARIABLES
# Do not modify these from the command line.
SRC = ptar.c
OBJ = $(SRC:.c=.o)
INSTALL_PROGRAM = $(INSTALL) -p -o $(INSTALL_USER) -g $(INSTALL_GROUP) -m 755 -s
DISTCONTENTS = COPYING AUTHORS README.md FORMAT.md $(BINFILE)
# TARGETS
all: options $(BINFILE)
options:
@echo "ptar build options:"
@echo "CFLAGS = $(CFLAGS)"
@echo "LDFLAGS = $(LDFLAGS)"
@echo "CC = $(CC)"
@echo
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
$(BINFILE): $(OBJ)
$(CC) -o $@ $(OBJ) $(LDFLAGS)
clean:
rm -f $(BINFILE) $(OBJ) $(DISTARCHIVE)
install: $(BINFILE)
$(INSTALL_PROGRAM) $(BINFILE) $(BINDIR)/$(BINFILE)
uninstall:
rm -f $(BINDIR)/$(BINFILE)
dist: $(DISTARCHIVE)
$(DISTARCHIVE): all
$(PWD)/$(BINFILE) c $(DISTCONTENTS) >$@