-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile.in
100 lines (82 loc) · 2.51 KB
/
Makefile.in
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
TOP := $(shell pwd)
INCLUDES := -I$(TOP)
CFLAGS := @GUILE_CFLAGS@ -fPIC -MD -DHAVE_CONFIG_H $(INCLUDES)
LIBS := @GUILE_LIBS@ -shared
LDFLAGS := @GUILE_LDFLAGS@ -fPIC -shared
CC := @CC@
OBJ := obj
CEE := cee
ceelib-ofile := $(OBJ)/libragnarok.so
EVENT := $(CEE)/event
eventlib-ofile := $(OBJ)/libragnarok-event.so
MOD := ragnarok
MOD_OBJ := $(OBJ)/ragnarok
BIN_OBJ := $(OBJ)/bin
TEMP_LIB_PATH := $(shell pwd)/$(OBJ)
MOD_COMPILED_PATH := $(shell guile -c "(display %compile-fallback-path)")
MOD_TMP_PATH := $(MOD_COMPILED_PATH)/$(TOP)
MOD_PATH := $(shell guile -c "(display (car %load-path))")
MOD_TARGET_PATH := $(MOD_COMPILED_PATH)/$(MOD_PATH)/ragnarok
GUILEC := LD_LIBRARY_PATH=$(TEMP_LIB_PATH) guild compile
RAGNAROK_ETC := etc/ragnarok
RAGNAROK_TOOLS := tools
GUILE := @GUILE@
VERSION := @PACKAGE_VERSION@
PREFIX := @prefix@
INSTALL := install -c
V := @
mod-sfile := $(shell find $(MOD) -name *.scm)
mod-ofile := $(mod-sfile:.scm=.scm.go)
mod-ofile := $(subst $(MOD)/,$(MOD_OBJ)/,$(mod-ofile))
ALL_TARGETS := $(ceelib-ofile) \
$(eventlib-ofile) \
version \
modules \
$(OBJ)/bin/ragnarok
all: $(ALL_TARGETS)
include $(CEE)/Makefile.mk
include $(EVENT)/Makefile.mk
$(MOD_OBJ)/%.scm.go: $(MOD)/%.scm $(ceelib-ofile) $(eventlib-ofile)
@echo + guilec $<
@mkdir -p $(@D)
$(V)$(GUILEC) -L $(TOP) -o $@ $<
$(BIN_OBJ)/ragnarok: bin/ragnarok.c
@echo building Ragnarok ...
@mkdir -p $(@D)
$(V)$(CC) @GUILE_CFLAGS@ @GUILE_LIBS@ -o $@ $<
$(MOD)/version.scm:
$(V)$(GUILE) -c '(call-with-output-file "$@" (lambda (port) (format port "(define-module (ragnarok version) #:export (*ragnarok-version*)) (define *ragnarok-version* \"Ragnarok ~a\")" "$(VERSION)")))'
.PHONY: clean modules install distclean distclean-mk bin version test gen-mime
clean:
-rm -fr $(OBJ)
-rm -fr *.log
-rm -rf autom4te.cache
-rm -rf $(MOD)/version.scm
-rm -rf $(MOD_TMP_PATH)
clean-config:
-rm -rf config.{h,log}
-rm -rf configure
install: $(ALL_TARGETS)
cp -frdp $(OBJ)/*.so $(PREFIX)/lib
cp -frdp $(MOD) $(MOD_PATH)
$(INSTALL) -m 755 -d $(MOD_TARGET_PATH)
cp -frdp $(MOD_OBJ)/* $(MOD_TARGET_PATH)
chmod a+w $(MOD_TARGET_PATH)/* -R
$(INSTALL) -m 755 $(OBJ)/bin/* $(PREFIX)/bin
cp -frdp $(RAGNAROK_ETC) /etc
distclean: distclean-mk clean clean-config
distclean-mk:
-rm -f Makefile
modules: $(mod-ofile)
version: $(MOD)/version.scm
bin: $(OBJ)/bin/ragnarok
gen-mime:
$(RAGNAROK_TOOLS)/regen-mime-list.sh > $(RAGNAROK_ETC)/mime.list
test:
@echo $(PREFIX)
@echo $(MOD_COMPILED_PATH)
@echo $(CC)
@echo $(CFLAGS)
@echo $(GUILE)
@echo $(VERSION)
@echo $(LIBS)