forked from noss/erlang-gettext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
include.mk
77 lines (53 loc) · 1.74 KB
/
include.mk
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
## -*- makefile -*-
######################################################################
## C
CC := @CC@
CFLAGS := @CFLAGS@ @DEFS@
LD_SHARED := @LD_SHARED@
SLANG_INCLUDE := @SLANG_INCLUDE@
######################################################################
## Erlang
ERL := erl
ERLC := erlc
ERLDIR := @ERLDIR@
ERL_C_INCLUDE_DIR := $(ERLDIR)/usr/include
JUNGERL_DIR := .
ERLC_FLAGS := -W -I $(JUNGERL_DIR)/lib
ifndef no_debug_info
ERLC_FLAGS += +debug_info
endif
ifdef debug
ERLC_FLAGS += -Ddebug
endif
EBIN_DIR := ../ebin
DOC_DIR := ../doc
EMULATOR := beam
ERL_SOURCES := $(wildcard *.erl)
ERL_HEADERS := $(wildcard *.hrl) $(wildcard ../include/*.hrl)
ERL_OBJECTS := $(ERL_SOURCES:%.erl=$(EBIN_DIR)/%.$(EMULATOR))
ERL_DOCUMENTS := $(ERL_SOURCES:%.erl=$(DOC_DIR)/%.html)
# Hmm, don't know if you are supposed to like this better... ;-)
APPSCRIPT = '$$vsn=shift; $$mods=""; while(@ARGV){ $$_=shift; s/^([A-Z].*)$$/\'\''$$1\'\''/; $$mods.=", " if $$mods; $$mods .= $$_; } while(<>) { s/%VSN%/$$vsn/; s/%MODULES%/$$mods/; print; }'
../ebin/%.app: %.app.src ../vsn.mk Makefile
perl -e $(APPSCRIPT) "$(VSN)" $(MODULES) < $< > $@
../ebin/%.appup: %.appup
cp $< $@
$(EBIN_DIR)/%.$(EMULATOR): %.erl
$(ERLC) $(ERLC_FLAGS) -o $(EBIN_DIR) $<
# generate documentation with edoc:
# this is still not the proper way to do it, but it works
# (see the wumpus application for an example)
$(DOC_DIR)/%.html: %.erl
${ERL} -noshell \
-pa ../../syntax_tools/ebin \
-pa ../../edoc/ebin \
-pa ../../xmerl/ebin \
-pa ../../ucs/ebin \
-run edoc file $< -run init stop
mv *.html $(DOC_DIR)
# C linking items
NSL_LIBS = @NSL_LIBS@
SOCKET_LIBS = @SOCKET_LIBS@
# Miscellaneous
GROFF = @GROFF@
PS2PDF = @PS2PDF@