-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
65 lines (42 loc) · 1.36 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
SHELL=/bin/bash
UNAME := $(shell uname)
prefix = /usr/local
exec_prefix = $(prefix)
libdir = $(exec_prefix)/lib
includedir = $(prefix)/include
SRC_INCLUDE_DIR = include/prosopon
ifeq ($(UNAME), Darwin)
LIBTOOL = glibtool --tag="junk"
else
LIBTOOL = libtool
endif
CC = gcc
DOC = doxygen
CFLAGS = -std=c99 -I$(SRC_INCLUDE_DIR) -Iprosopon
DOC_FLAGS =
SRC_DIR = src
TEST_DIR = test
OUT_DIR = build
LIBPROSOPON_STDLIB = libprosopon-stdlib.la
PROSOPON_HEADER_DIR = $(includedir)/prosopon
OBJS = prosopon_stdlib pro_number pro_string pro_stdio prosopon_macros pro_matching pro_future pro_forward
OUT_OBJS = $(addprefix $(OUT_DIR)/,$(OBJS))
HEADERS = prosopon_stdlib.h prosopon_macros.h
OUT_HEADERS = $(addprefix $(SRC_INCLUDE_DIR)/,$(HEADERS))
all : $(LIBPROSOPON_STDLIB)
$(LIBPROSOPON_STDLIB) : $(addsuffix .lo,$(OUT_OBJS))
$(LIBTOOL) --mode=link gcc $(CFLAGS) -O -o $@ $^ -rpath $(libdir) -lprosopon
$(OUT_DIR)/%.lo : $(SRC_DIR)/%.c
$(LIBTOOL) --mode=compile gcc $(CFLAGS) -fPIC -c $^ -o $@
install: $(LIBPROSOPON_STDLIB) copy_headers
$(LIBTOOL) --mode=install cp $< $(libdir)/$<
copy_headers:
if [ ! -d $(PROSOPON_HEADER_DIR) ]; then mkdir $(PROSOPON_HEADER_DIR); fi
cp $(OUT_HEADERS) $(PROSOPON_HEADER_DIR)
.PHONY : doc
doc :
doxygen Doxyfile
.PHONY : clean
clean :
rm -f $(OUT_DIR)/*
if [ -f libprosopon-stdlib.so.* ]; then rm libprosopon-stdlib.so.*; fi