Skip to content

Commit fcd8f26

Browse files
committed
Add top level Makefile for compiling a shared object
1 parent 9cda72d commit fcd8f26

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
MKDIR_P = mkdir -p
2+
RM = rm
3+
INSTALL = install
4+
5+
CC = gcc
6+
CFLAGS = -std=gnu99 -O2 -Wall -Wshadow -Isrc
7+
LDFLAGS = $(CFLAGS)
8+
9+
PREFIX = /usr/local
10+
LIBDIR = $(PREFIX)/lib64
11+
INCDIR = $(PREFIX)/include
12+
13+
libfathom.so: obj/tbprobe.o
14+
$(CC) $(LDFLAGS) -shared $^ -o $@
15+
16+
obj/tbprobe.o: src/tbprobe.c src/tbchess.c src/stdendian.h src/tbprobe.h
17+
@$(MKDIR_P) obj
18+
$(CC) $(CFLAGS) -fPIC -c $< -o $@
19+
20+
clean:
21+
$(RM) -f libfathom.so
22+
$(RM) -rf obj
23+
24+
install: libfathom.so
25+
$(MKDIR_P) $(DESTDIR)$(LIBDIR)
26+
$(INSTALL) -m 0644 libfathom.so $(DESTDIR)$(LIBDIR)
27+
$(INSTALL) -m 0644 src/{stdendian,tbconfig,tbprobe}.h $(DESTDIR)$(INCDIR)
28+
29+
uninstall:
30+
$(RM) -f $(DESTDIR)$(LIBDIR)/libfathom.so
31+
$(RM) -f $(DESTDIR)$(INCDIR)/{stdendian,tbconfig,tbprobe}.h
32+
33+
.PHONY: clean install uninstall

0 commit comments

Comments
 (0)