1#-*-makefile-*-   ; force emacs to enter makefile-mode
2
3# %CopyrightBegin%
4#
5# Copyright Ericsson AB 1996-2016. All Rights Reserved.
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11#     http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18#
19# %CopyrightEnd%
20
21include $(ERL_TOP)/make/target.mk
22include $(ERL_TOP)/make/$(TARGET)/otp.mk
23
24# ----------------------------------------------------
25# Common Macros
26# ----------------------------------------------------
27
28include subdirs.mk
29
30include vsn.mk
31
32VSN = $(SNMP_VSN)
33
34SPECIAL_TARGETS =
35
36DIR_NAME = snmp_src-$(VSN)$(PRE_VSN)
37
38ifndef APP_RELEASE_DIR
39  APP_RELEASE_DIR = /tmp
40endif
41
42ifndef APP_TAR_FILE
43  APP_TAR_FILE = $(APP_RELEASE_DIR)/$(DIR_NAME).tgz
44endif
45
46APP_DIR = $(APP_RELEASE_DIR)/$(DIR_NAME)
47
48ifdef OTP_INSTALL_DIR
49  APP_INSTALL_DIR = $(OTP_INSTALL_DIR)/lib/erlang
50else
51  # If installing into an OTP structure created
52  # by installing an source OTP build, the '/tmp'
53  # shall be replaced with the value of ERL_TOP
54  APP_INSTALL_DIR = /tmp/lib/erlang
55endif
56
57
58DIA_PLT      = ./priv/plt/$(APPLICATION).plt
59DIA_ANALYSIS = $(basename $(DIA_PLT)).dialyzer_analysis
60
61# ----------------------------------------------------
62# Default Subdir Targets
63# ----------------------------------------------------
64include $(ERL_TOP)/make/otp_subdir.mk
65
66conf: do_configure
67
68do_configure: configure
69	./configure
70
71configure: configure.in
72	autoconf
73
74# ----------------------------------------------------
75# Application (source) release targets
76# ----------------------------------------------------
77app_release: app_doc tar
78
79app_clean:
80	rm -rf $(APP_TAR_FILE) $(APP_DIR)
81
82app_doc:
83	cd doc/src; $(MAKE) html man
84
85app_dir: $(APP_DIR)
86
87$(APP_DIR):
88	cat TAR.exclude | grep -v "snmp/doc" > TAR.exclude2; \
89        echo "snmp/doc/src" >> TAR.exclude2; \
90        echo "snmp/TAR.exclude2" >> TAR.exclude2; \
91        echo "snmp/doc/internal" >> TAR.exclude2; \
92        echo "snmp/mibs/prebuild.skip" >> TAR.exclude2
93	(cd ..; find snmp -name 'findmerge.*' >> snmp/TAR.exclude2)
94	(cd ..; find snmp -name '*.contrib*' >> snmp/TAR.exclude2)
95	(cd ..; find snmp -name '*.keep*' >> snmp/TAR.exclude2)
96	(cd ..; find snmp -name '*~' >> snmp/TAR.exclude2)
97	(cd ..; find snmp -name '*.log' >> snmp/TAR.exclude2)
98	(cd ..; find snmp -name 'erl_crash.dump' >> snmp/TAR.exclude2)
99	mkdir $(APP_DIR); \
100        (cd ..; tar cfX - snmp/TAR.exclude2 snmp) | \
101        (cd $(APP_DIR); tar xf -); \
102        mv $(APP_DIR)/snmp/* $(APP_DIR)/; \
103        find $(APP_DIR)/snmp -name '.cmake.state' | xargs rm -f; \
104	mkdir $(APP_DIR)/autoconf; \
105        cp autoconf/config.guess $(APP_DIR)/autoconf/; \
106        cp autoconf/config.sub $(APP_DIR)/autoconf/; \
107        cp autoconf/install-sh $(APP_DIR)/autoconf/; \
108        rmdir $(APP_DIR)/snmp
109
110tar: $(APP_TAR_FILE)
111
112$(APP_TAR_FILE): $(APP_DIR)
113	(cd $(APP_RELEASE_DIR); gtar zcf $(APP_TAR_FILE) $(DIR_NAME))
114
115DIA_PLT_APPS=runtime_tools crypto mnesia
116
117include $(ERL_TOP)/make/app_targets.mk
118