blob: 78af14f68b615de163d1f774e687d7a50915e78b [file] [log] [blame]
David Reissae756f42008-06-10 22:57:11 +00001# $Id: Makefile,v 1.3 2004/08/13 16:35:59 mlogan Exp $
2#
3include ../build/otp.mk
4include ../build/colors.mk
5include ../build/buildtargets.mk
6
7# ----------------------------------------------------
8# Application version
9# ----------------------------------------------------
10
11include ../vsn.mk
12APP_NAME=thrift
13PFX=thrift
14VSN=$(THRIFT_VSN)
15
16# ----------------------------------------------------
17# Install directory specification
18# WARNING: INSTALL_DIR the command to install a directory.
19# INSTALL_DST is the target directory
20# ----------------------------------------------------
21INSTALL_DST = $(ERLANG_OTP)/lib/$(APP_NAME)-$(VSN)
22
23# ----------------------------------------------------
24# Target Specs
25# ----------------------------------------------------
26
27
David Reiss080991b2008-10-30 04:28:42 +000028MODULES = $(shell find . -name \*.erl | sed 's:^\./::' | sed 's/\.erl//')
29MODULES_STRING_LIST = $(shell find . -name \*.erl | sed 's:^\./:":' | sed 's/\.erl/",/')
David Reissc549f7b2010-08-30 22:06:01 +000030BEHAV_MODULES = $(shell find . -name \*.erl | xargs grep -l behaviour_info | sed 's:^\./::' | sed 's/\.erl//')
David Reissae756f42008-06-10 22:57:11 +000031
32HRL_FILES=
33INTERNAL_HRL_FILES= $(APP_NAME).hrl
34ERL_FILES= $(MODULES:%=%.erl)
35DOC_FILES=$(ERL_FILES)
36
37APP_FILE= $(APP_NAME).app
38APPUP_FILE= $(APP_NAME).appup
39
40APP_SRC= $(APP_FILE).src
41APPUP_SRC= $(APPUP_FILE).src
42
43APP_TARGET= $(EBIN)/$(APP_FILE)
44APPUP_TARGET= $(EBIN)/$(APPUP_FILE)
45
46BEAMS= $(MODULES:%=$(EBIN)/%.$(EMULATOR))
David Reissc549f7b2010-08-30 22:06:01 +000047BEHAV_BEAMS= $(BEHAV_MODULES:%=$(EBIN)/%.$(EMULATOR))
48TARGET_FILES= $(BEHAV_BEAMS) $(BEAMS) $(APP_TARGET) $(APPUP_TARGET)
David Reissae756f42008-06-10 22:57:11 +000049
50WEB_TARGET=/var/yaws/www/$(APP_NAME)
51
52# ----------------------------------------------------
53# FLAGS
54# ----------------------------------------------------
55
56ERL_FLAGS +=
David Reiss6563f342008-06-11 00:58:55 +000057ERL_INCLUDE = -I../include -I../../fslib/include -I../../system_status/include
David Reissc549f7b2010-08-30 22:06:01 +000058ERL_BEHAV_PATH = -pz ../ebin
59ERL_COMPILE_FLAGS += $(ERL_INCLUDE) $(ERL_BEHAV_PATH)
David Reissae756f42008-06-10 22:57:11 +000060
61# ----------------------------------------------------
62# Targets
63# ----------------------------------------------------
64
David Reiss6563f342008-06-11 00:58:55 +000065all debug opt: $(EBIN) $(TARGET_FILES)
David Reissae756f42008-06-10 22:57:11 +000066
67#$(EBIN)/rm_logger.beam: $(APP_NAME).hrl
68include ../build/docs.mk
69
70# Note: In the open-source build clean must not destroy the preloaded
71# beam files.
72clean:
73 rm -f $(TARGET_FILES)
74 rm -f *~
75 rm -f core
76 rm -rf $(EBIN)
77 rm -rf *html
78
79$(EBIN):
80 mkdir $(EBIN)
81
David Reiss6563f342008-06-11 00:58:55 +000082dialyzer: $(TARGET_FILES)
83 dialyzer --src -r . $(ERL_INCLUDE)
84
David Reissae756f42008-06-10 22:57:11 +000085# ----------------------------------------------------
86# Special Build Targets
87# ----------------------------------------------------
88
89$(APP_TARGET): $(APP_SRC) ../vsn.mk $(BEAMS)
90 sed -e 's;%VSN%;$(VSN);' \
91 -e 's;%PFX%;$(PFX);' \
92 -e 's;%APP_NAME%;$(APP_NAME);' \
93 -e 's;%MODULES%;%MODULES%$(MODULES_STRING_LIST);' \
David Reiss6563f342008-06-11 00:58:55 +000094 $< > $<".tmp"
David Reissae756f42008-06-10 22:57:11 +000095 sed -e 's/%MODULES%\(.*\),/\1/' \
David Reiss6563f342008-06-11 00:58:55 +000096 $<".tmp" > $@
David Reissae756f42008-06-10 22:57:11 +000097 rm $<".tmp"
98
David Reissae756f42008-06-10 22:57:11 +000099$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
100 sed -e 's;%VSN%;$(VSN);' $< > $@
101
David Reiss6563f342008-06-11 00:58:55 +0000102$(WEB_TARGET): ../markup/*
103 rm -rf $(WEB_TARGET)
104 mkdir $(WEB_TARGET)
David Reissae756f42008-06-10 22:57:11 +0000105 cp -r ../markup/ $(WEB_TARGET)
106 cp -r ../skins/ $(WEB_TARGET)
107
108# ----------------------------------------------------
109# Install Target
David Reiss6563f342008-06-11 00:58:55 +0000110# ----------------------------------------------------
David Reissae756f42008-06-10 22:57:11 +0000111
112install: all $(WEB_TARGET)
113# $(INSTALL_DIR) $(INSTALL_DST)/src
114# $(INSTALL_DATA) $(ERL_FILES) $(INSTALL_DST)/src
115# $(INSTALL_DATA) $(INTERNAL_HRL_FILES) $(INSTALL_DST)/src
116# $(INSTALL_DIR) $(INSTALL_DST)/include
117# $(INSTALL_DATA) $(HRL_FILES) $(INSTALL_DST)/include
118# $(INSTALL_DIR) $(INSTALL_DST)/ebin
119# $(INSTALL_DATA) $(TARGET_FILES) $(INSTALL_DST)/ebin