forked from ashinn/chibi-scheme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.libs
115 lines (94 loc) · 3.22 KB
/
Makefile.libs
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
# -*- makefile-gmake -*-
# Include-able makefile for building Chibi libraries - see README.libs
# for usage.
.PHONY: all all-libs clean clean-libs dist-clean dist-clean-libs install install-libs uninstall uninstall-libs doc doc-libs
.PRECIOUS: %.c lib/%.c
# install configuration
CC ?= cc
AR ?= ar
CD ?= cd
RM ?= rm -f
LS ?= ls
CP ?= cp
LN ?= ln -sf
INSTALL ?= install
INSTALL_EXE ?= $(INSTALL)
MKDIR ?= $(INSTALL) -d
RMDIR ?= rmdir
TAR ?= tar
DIFF ?= diff
GIT ?= git
GREP ?= grep
FIND ?= find
SYMLINK ?= ln -s
LDCONFIG ?= ldconfig
# gnu coding standards
prefix ?= /usr/local
PREFIX ?= $(prefix)
exec_prefix ?= $(PREFIX)
bindir ?= $(exec_prefix)/bin
libdir ?= $(exec_prefix)/lib
includedir ?= $(PREFIX)/include
datarootdir ?= $(PREFIX)/share
datadir ?= $(datarootdir)
mandir ?= $(datarootdir)/man
man1dir ?= $(mandir)/man1
# hysterical raisins
BINDIR ?= $(bindir)
LIBDIR ?= $(libdir)
SOLIBDIR ?= $(libdir)
INCDIR ?= $(includedir)/chibi
MODDIR ?= $(datadir)/chibi
BINMODDIR ?= $(SOLIBDIR)/chibi
PKGCONFDIR ?= $(SOLIBDIR)/pkgconfig
MANDIR ?= $(man1dir)
# allow snow to be configured separately
SNOWPREFIX ?= /usr/local
SNOWLIBDIR ?= $(SNOWPREFIX)/lib
SNOWSOLIBDIR ?= $(SNOWLIBDIR)
SNOWMODDIR ?= $(SNOWPREFIX)/share/snow
SNOWBINMODDIR ?= $(SNOWSOLIBDIR)/snow
# for packaging tools
DESTDIR ?=
########################################################################
# System configuration - if not using GNU make, set PLATFORM and the
# flags from Makefile.detect (at least SO, EXE, CLIBFLAGS) as necessary.
include Makefile.detect
########################################################################
all-libs: $(COMPILED_LIBS) lib/chibi/snow/install.sld
lib/%.c: lib/%.stub $(CHIBI_FFI_DEPENDENCIES)
$(CHIBI_FFI) $<
lib/chibi/pty$(SO): lib/chibi/pty.c $(INCLUDES) libchibi-scheme$(SO)
$(CC) $(CLIBFLAGS) $(CLINKFLAGS) $(XCPPFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ $< -L. $(RLDFLAGS) $(XLIBS) -lchibi-scheme -lutil
lib/%$(SO): lib/%.c $(INCLUDES) libchibi-scheme$(SO)
$(CC) $(CLIBFLAGS) $(CLINKFLAGS) $(XCPPFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ $< -L. $(RLDFLAGS) $(XLIBS) -lchibi-scheme
doc-libs: $(HTML_LIBS)
doc/lib/%.html: lib/%.sld $(CHIBI_DOC_DEPENDENCIES)
$(MKDIR) $(dir $@)
$(CHIBI_DOC) --html $(subst /,.,$*) > $@
clean-libs:
$(RM) $(COMPILED_LIBS)
$(RM) -r $(patsubst %,%.dSYM,$(COMPILED_LIBS))
$(RM) $(HTML_LIBS)
dist-clean-libs: clean-libs
$(RM) $(patsubst %.stub, %.c, $(shell $(FIND) lib -name \*.stub))
install-libs: all-libs
for dir in $(dir $(patsubst lib/%,%,$(COMPILED_LIBS))) ; do \
$(MKDIR) $(DESTDIR)$(BINMODDIR)/$$dir; \
done
for file in $(patsubst lib/%,%,$(COMPILED_LIBS)) ; do \
$(INSTALL) lib/$$file $(DESTDIR)$(BINMODDIR)/$$file ; \
done
for dir in $(dir $(patsubst lib/%,%,$(SCM_LIBS))) ; do \
$(MKDIR) $(DESTDIR)$(MODDIR)/$$dir; \
done
for file in $(patsubst lib/%,%,$(SCM_LIBS)) ; do \
$(INSTALL) lib/$$file $(DESTDIR)$(MODDIR)/$$file ; \
done
uninstall-libs:
for file in $(patsubst lib/%,%,$(COMPILED_LIBS)) ; do \
$(RM) $(DESTDIR)$(BINMODDIR)/$$file ; \
done
for file in $(patsubst lib/%,%,$(SCM_LIBS)) ; do \
$(RM) $(DESTDIR)$(MODDIR)/$$file ; \
done