-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
144 lines (123 loc) · 4.44 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
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
134
135
136
137
138
139
140
141
142
143
144
################################################################################
# Encoding: UTF-8 Tab size: 4 #
# #
# GNU MAKEFILE FOR LINASM #
# #
# License: LGPLv3+ Copyleft (Ɔ) 2015, Jack Black #
################################################################################
#******************************************************************************#
# Installation directories #
#******************************************************************************#
# Project directories
incdir := include
srcdir := source
# System directories
prefix := /usr/local
exec_prefix := $(prefix)
sysconfdir := $(prefix)/etc
includedir := $(prefix)/include
datarootdir := $(prefix)/share
localstatedir := $(prefix)/var
sbindir := $(exec_prefix)/sbin
bindir := $(exec_prefix)/bin
libdir := $(exec_prefix)/lib
datadir := $(datarootdir)
localedir := $(datarootdir)/locale
icondir := $(datarootdir)/icons
infodir := $(datarootdir)/info
docdir := $(datarootdir)/doc/pkg_name
mandir := $(datarootdir)/man
man1dir := $(mandir)/man1
man2dir := $(mandir)/man2
man3dir := $(mandir)/man3
man4dir := $(mandir)/man4
man5dir := $(mandir)/man5
man6dir := $(mandir)/man6
man7dir := $(mandir)/man7
man8dir := $(mandir)/man8
htmldir := $(docdir)
pdfdir := $(docdir)
dvidir := $(docdir)
psdir := $(docdir)
man1ext := .1
man2ext := .2
man3ext := .3
man4ext := .4
man5ext := .5
man6ext := .6
man7ext := .7
man8ext := .8
#******************************************************************************#
# Utility configuration #
#******************************************************************************#
# Utility names
AS := build/fasm
LD := ld
LN := ln
INSTALL := install
# Utility flags
ASFLAGS :=
LDFLAGS :=
LNFLAGS :=
INSTALLFLAGS :=
#******************************************************************************#
# Makefile variables #
#******************************************************************************#
vpath %.h $(incdir)
vpath %.inc $(srcdir)
vpath %.asm $(srcdir)
INSTALL_PROGRAM := $(INSTALL)
INSTALL_DATA := $(INSTALL) -m 644
lib := liblinasm.so
ver := 1.1
vlib := $(lib).$(ver)
includes := $(notdir $(wildcard $(incdir)/*.h))
objects := $(notdir $(patsubst %.asm, %.o, $(wildcard $(srcdir)/*.asm)))
#******************************************************************************#
# Makefile targets #
#******************************************************************************#
.SUFFIXES:
.PHONY: uninstall clean distclean mostlyclean maintainer-clean
all: $(lib)
$(lib): $(objects)
$(LD) --shared $(LDFLAGS) $^ -o $@
%.o: %.asm
$(AS) $(ASFLAGS) $< $@
Accumulator.o: Macro.inc Syscall.inc
Approximation.o: Macro.inc
Array.o: Macro.inc
Btree.o: Macro.inc Syscall.inc
Deque.o: Macro.inc Syscall.inc
FHT.o: Macro.inc
Filter.o: Macro.inc
Hash.o: Macro.inc Syscall.inc
Heap.o: Macro.inc Syscall.inc
List.o: Macro.inc Syscall.inc
Math.o: Macro.inc
Matrix.o: Macro.inc
Numbers.o: Macro.inc
Pool.o: Macro.inc Syscall.inc
Statistics.o: Macro.inc
String.o: Macro.inc
Time.o: Errno.inc Syscall.inc
Vector.o: Macro.inc Syscall.inc
VectorXD.o: Macro.inc
Window.o: Macro.inc
install: $(lib) $(includes)
$(INSTALL_DATA) -Dp $(INSTALLFLAGS) $(lib) $(DESTDIR)$(libdir)/$(vlib)
$(LN) -sf $(DESTDIR)$(libdir)/$(vlib) $(DESTDIR)$(libdir)/$(lib)
cd $(incdir) && $(foreach file, $(includes), $(INSTALL_DATA) -Dp $(INSTALLFLAGS) $(file) $(DESTDIR)$(includedir)/$(file);)
uninstall:
-cd $(DESTDIR)$(libdir) && rm -f $(lib) $(vlib)
-cd $(DESTDIR)$(includedir) && rm -f $(includes)
clean:
-rm -f $(lib) $(objects)
distclean:
-rm -f $(lib) $(objects)
mostlyclean:
-rm -f $(lib) $(objects)
maintainer-clean:
-rm -f $(lib) $(objects)
################################################################################
# END OF FILE #
################################################################################