Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nocache
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Danil Mikhailov
nocache
Commits
2830e104
Commit
2830e104
authored
May 29, 2013
by
Dmitry Smirnov
Committed by
Julius Plenz
May 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GNU Make best practice
parent
609e03d4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
39 deletions
+57
-39
Makefile
Makefile
+56
-24
nocache.global
nocache.global
+0
-12
nocache.in
nocache.in
+1
-3
No files found.
Makefile
View file @
2830e104
default
:
all
all
:
cachestats cachedel nocache.so
.PHONY
:
test
#!/usr/bin/make -f
# -*- makefile -*-
GCC
=
gcc
$(CFLAGS)
%.c
:
Makefile
cachestats
:
cachestats.c
$(GCC)
-Wall
-o
cachestats cachestats.c
cachedel
:
cachedel.c
$(GCC)
-Wall
-o
cachedel cachedel.c
nocache.o
:
nocache.c
$(GCC)
-Wall
-fPIC
-c
-o
nocache.o nocache.c
fcntl_helpers.o
:
fcntl_helpers.c
$(GCC)
-Wall
-fPIC
-c
-o
fcntl_helpers.o fcntl_helpers.c
nocache.so
:
nocache.o fcntl_helpers.o
$(GCC)
-Wall
-pthread
-shared
-Wl
,-soname,nocache.so
-o
nocache.so nocache.o fcntl_helpers.o
-ldl
install
:
all
install
-m
0644 nocache.so /usr/local/lib
install
-m
0755 nocache.global /usr/local/bin/nocache
test
:
cd
t
;
prove
-v
.
PREFIX
?=
/usr/local
MANDIR
?=
/share/man/man1
BINDIR
?=
/bin
LIBDIR
?=
/lib
mandir
=
$(DESTDIR)$(PREFIX)$(MANDIR)
bindir
=
$(DESTDIR)$(PREFIX)$(BINDIR)
libdir
=
$(DESTDIR)$(PREFIX)$(LIBDIR)
CACHE_BINS
=
cachedel cachestats
NOCACHE_BINS
=
nocache.o fcntl_helpers.o
MANPAGES
=
$
(
wildcard man/
*
.1
)
CFLAGS
+=
-Wall
GCC
=
gcc
$(CFLAGS)
$(CPPFLAGS)
$(LDFLAGS)
.PHONY
:
all
all
:
$(CACHE_BINS) nocache.so nocache
$(CACHE_BINS)
:
$(GCC)
-o
$@
$@
.c
$(NOCACHE_BINS)
:
$(GCC)
-fPIC
-c
-o
$@
$
(
@:.o
=
.c
)
nocache.global
:
sed
's!##libdir##!$(subst
$(DESTDIR)
,,
$(libdir)
)!'
<nocache.in
>
$@
clean
:
rm
-f
cachestats cachedel fcntl_helpers.o nocache.o nocache.so
nocache
:
sed
's!##libdir##!$$(dirname "$$0")!'
<nocache.in
>
$@
chmod
a+x
$@
nocache.so
:
$(NOCACHE_BINS)
$(GCC)
-pthread
-shared
-Wl
,-soname,nocache.so
-o
nocache.so
$(NOCACHE_BINS)
-ldl
$(mandir) $(libdir) $(bindir)
:
mkdir
-v
-p
$@
install
:
all $(mandir) $(libdir) $(bindir) nocache.global
install
-m
0644 nocache.so
$(libdir)
install
-m
0755 nocache.global
$(bindir)
/nocache
install
-m
0755
$(CACHE_BINS)
$(bindir)
install
-m
0644
$(MANPAGES)
$(mandir)
.PHONY
:
uninstall
uninstall
:
cd
$(mandir)
&&
$(RM)
-v
$
(
notdir
$(MANPAGES)
)
$(RM)
-v
$(bindir)
/nocache
$(libdir)
/nocache.so
.PHONY
:
clean distclean
clean distclean
:
$(RM)
-v
$(CACHE_BINS)
$(NOCACHE_BINS)
nocache.so nocache nocache.global
.PHONY
:
test
test
:
all
cd
t
;
prove
-v
.
nocache.global
deleted
100755 → 0
View file @
609e03d4
#!/bin/sh
BASEDIR
=
"/usr/local"
libnocache
=
"
$BASEDIR
/lib/nocache.so"
export
LD_PRELOAD
=
"
$libnocache
$LD_PRELOAD
"
if
[
"
$1
"
=
"-n"
]
;
then
export
NOCACHE_NR_FADVISE
=
"
$2
"
shift
2
fi
exec
"
$@
"
nocache
→
nocache
.in
100755 → 100644
View file @
2830e104
#!/bin/sh
NOCACHE_PATH
=
$(
dirname
"
$0
"
)
libnocache
=
"
$NOCACHE_PATH
/nocache.so"
export
LD_PRELOAD
=
"
$libnocache
$LD_PRELOAD
"
export
LD_PRELOAD
=
"
##libdir##/nocache.so
$LD_PRELOAD
"
if
[
"
$1
"
=
"-n"
]
;
then
export
NOCACHE_NR_FADVISE
=
"
$2
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment