-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
60 lines (47 loc) · 2.1 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
############################################################################
# oomify #
# Copyright (C) 2020 Tavian Barnes <[email protected]> #
# #
# Permission to use, copy, modify, and/or distribute this software for any #
# purpose with or without fee is hereby granted. #
# #
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES #
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF #
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR #
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES #
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN #
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF #
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #
############################################################################
CC ?= gcc
INSTALL ?= install
MKDIR ?= mkdir -p
RM ?= rm -f
CFLAGS ?= -g -Wall -Wmissing-declarations -Wstrict-prototypes
LDFLAGS ?=
DEPFLAGS ?= -MD -MP -MF $(@:.o=.d)
DESTDIR ?=
PREFIX ?= /usr
LOCAL_CPPFLAGS := -D_DEFAULT_SOURCE
LOCAL_CFLAGS := -std=c11 -fPIC
ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS)
ALL_CFLAGS = $(ALL_CPPFLAGS) $(LOCAL_CFLAGS) $(CFLAGS) $(DEPFLAGS)
ALL_LDFLAGS = $(ALL_CFLAGS) $(LOCAL_LDFLAGS) $(LDFLAGS)
default: oomify liboomify.so
oomify: oomify.o
$(CC) $(ALL_LDFLAGS) -pie $^ -o $@
liboomify.so: oominject.o
$(CC) $(ALL_LDFLAGS) -shared $^ -o $@
%.o: %.c
$(CC) $(ALL_CFLAGS) -c $< -o $@
clean:
$(RM) oomify liboomify.so *.o
install:
$(MKDIR) $(DESTDIR)$(PREFIX)/bin
$(INSTALL) -m755 oomify $(DESTDIR)$(PREFIX)/bin/oomify
$(MKDIR) $(DESTDIR)$(MANDIR)/lib
$(INSTALL) -m755 liboomify.so $(DESTDIR)$(MANDIR)/lib/liboomify.so
uninstall:
$(RM) $(DESTDIR)$(PREFIX)/bin/oomify
$(RM) $(DESTDIR)$(MANDIR)/lib/liboomify.so
.PHONY: clean install uninstall