summaryrefslogtreecommitdiff
path: root/include/makeinclude/rules.local.GNU
blob: f81abdc50cbdbb427b50d542f27a6c071ed14c77 (plain)
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#----------------------------------------------------------------------------
#	$Id$
#
#	Local targets
#	GNU version
#	Requires GNU make
#----------------------------------------------------------------------------

ifndef OBJDIRS
  OBJDIRS = .obj .shobj # .obj_debug .obj_profile .obj_optimize
endif # OBJDIRS

#### TEMPLATE_REPOSITORY can be set in individual platform files
#### to create template repository directories.	 See
#### platform_sunos5_sunc++.GNU for an example.
OBJDIRS += $(TEMPLATE_REPOSITORY)

all.local: build.objdirs build.local install.local

#----------------------------------------------------------------------------
#	C/C++ compilation targets
#----------------------------------------------------------------------------

build.local: $(BUILD)

# Set up the suffixes for C++ and IDL.
.SUFFIXES:
.SUFFIXES: .cpp .cc .C .idl $(SUFFIXES)

# and here's how to compile C++ files from the IDL file.
# only ONE of these rules will be run at make-time,

%S.cpp: %.idl
	$(IDL) $(IDLFLAGS) $<

%C.cpp: %.idl
	$(IDL) $(IDLFLAGS) $<

%.hh: %.idl
	$(IDL) $(IDLFLAGS) $<

# C++ related targets

$(VDIR)%.o:	%.c
	$(COMPILE.c) -o $@ $<
	${MVCMD}

$(VDIR)%.o:	%.cpp
	$(COMPILE.cc) -o $@ $<
	${MVCMD}

#$(VDIR)%.o:	%.C
#	$(COMPILE.cc) -o $@ $<

#$(VDIR)%.o:	%.cc
#	$(COMPILE.cc) -o $@ $<

# If SOLINK is defined, then the .so file is built from the .o file via
# separate rules in the same directory.	 Otherwise, the .so and .o are
# built via the same rule.  SOLINK is required for the repository under
# gcc.
ifndef SOLINK
# I added the "Executable Shared Object (ESO)" define to separate between
# normal shared object files and executable shared object files (the kind
# that the service configurator needs to be able to function).
# 970104 Marius Kjeldahl <mariusk@sn.no, marius@funcom.com>
ifdef (ESOBUILD)
$(VSHDIR)%.$(SOEXT): %.cpp
	$(ESOBUILD)
else
$(VSHDIR)%.$(SOEXT): %.cpp
	$(SOBUILD)
endif
$(VSHDIR)%.o:	%.cpp
	$(COMPILE.cc) $(PIC) -o $@ $<
$(VSHDIR)%.o:	%.cc
	$(COMPILE.cc) $(PIC) -o $@ $<
$(VSHDIR)%.$(SOEXT):	$(VSHDIR)%.o
	$(SOLINK)
endif

#----------------------------------------------------------------------------
#	Library generation targets
#----------------------------------------------------------------------------

.PRECIOUS:	$(VLIB)

#### show_statics shows static objects in locally-created object files.
#### It assumes that the object files were built using g++.
#### TOOLENV selects the proper nm in VxWorks host environments.
#### TOOLDIR allows specification of the full path to nm via definition
#### in the platform_macros.GNU file.
show_statics:
	-@$(TOOLDIR)nm$(TOOLENV) -Co $(VSHDIR)*o | \
	  egrep ' global destructors '; true

#### show_uninit shows uninitialized data in locally-created object files.
#### TOOLENV selects the proper nm in VxWorks host environments.
show_uninit:
	-@$(TOOLDIR)nm$(TOOLENV) -Co $(VSHDIR)*o | egrep ' b '

#----------------------------------------------------------------------------
#	Installation targets
#----------------------------------------------------------------------------

install.local:	$(INSTALL)

deinstall.local:
	$(RM) $(INSTALL) $(LIB:%.a=$(INSLIB)/%*.a) $(SHLIB:%.$(SOEXT)=$(INSLIB)/%*.$(SOEXT))


#### To disable installs, just add "INSTALL=" to your "make" invocation.

$(INSBIN)/%$(VAR) \
$(INSINC)/ace% \
$(INSLIB)/%$(VAR).a \
$(INSLIB)/%$(VAR).$(SOEXT) \
$(INSMAN)/man1/% \
$(INSMAN)/man2/% \
$(INSMAN)/man3/% \
$(INSMAN)/man4/% \
$(INSMAN)/man5/% \
$(INSMAN)/man6/% \
$(INSMAN)/man7/% \
$(INSMAN)/man8/% \
$(INSMAN)/manl/% \
$(INSMAN)/mann/% :
	@if test $(shell pwd) != $(@D) ; then \
		if test -s $@ ; then \
			echo "$(@F) already installed" ; \
		else \
			echo "Installing $(@F) -> $(@D)" ; \
			ln -s $(shell pwd)/$(@F) $@ ; \
		fi ; \
	fi
ifdef MVSLIB
#special for MVS in order to use the .x files
	@if test -w $(@D) ; then \
		if test -s $(@:.$(SOEXT)=.x) ; then \
			echo "$(@F:.$(SOEXT)=.x) already installed" ; \
		else \
			echo "Installing $(@F:.$(SOEXT)=.x) -> $(@D)" ; \
			ln -s $(shell pwd)/$(@F:.$(SOEXT)=.x) $(@:.$(SOEXT)=.x) ; \
		fi \
	fi
endif

#----------------------------------------------------------------------------
#	Cleanup targets
#----------------------------------------------------------------------------

clean.local:
	-$(RM) -f *.o *~ *.bak *.rpo *.sym lib*.*_pure_* Makefile.old core
	-$(RM) -rf $(OBJDIRS) $(TEMPINCDIR) ptrepository Templates.DB \
		   gcctemp.c gcctemp so_locations

realclean.local: clean.local
	-$(RM) -f $(BIN:%=%) $(BIN:%=%_debug) $(BIN:%=%_profile) $(BIN:%=%_optimize) $(LIB:%=%) $(LIB:%=%_debug) $(LIB:%=%_profile) $(LIB:%=%_optimize) $(SHLIB:%=%) $(SHLIB:%=%_debug) $(SHLIB:%=%_profile) $(SHLIB:%=%_optimize)

#----------------------------------------------------------------------------
#	Dependency generation target
#----------------------------------------------------------------------------

ifndef MAKEFILE
MAKEFILE=Makefile
endif

depend.local: $(MAKEFILE)
	@$(RM) -f $(MAKEFILE).old
	@cp $(MAKEFILE) $(MAKEFILE).old
	$(ACE_ROOT)/bin/g++dep -f $(MAKEFILE) $(CPPFLAGS) -DMAKEDEPEND $(LSRC) $(SRC)
	@cat $(MAKEFILE) | \
		if [ $(TAO_ROOT). = "." ] ;\
		then \
		sed -e "s;$(ACE_ROOT);\$$(ACE_ROOT);g" \
		    -e "s; /[-a-zA-Z0-9_./]*\.h;;g" \
		    -e "/:$$/d" \
		    -e "s;\([-a-zA-Z0-9._]*\)\.o:;.obj/\1.o $(VSHDIR)\1.$(SOEXT):;" ;\
		else \
		sed -e "s;$(TAO_ROOT);\$$(TAO_ROOT);g" \
		    -e "s;$(ACE_ROOT);\$$(ACE_ROOT);g" \
		    -e "s; /[-a-zA-Z0-9_./]*\.h;;g" \
		    -e "/:$$/d" \
		    -e "s;\([-a-zA-Z0-9._]*\)\.o:;.obj/\1.o $(VSHDIR)\1.$(SOEXT):;" ;\
		fi \
	> $(MAKEFILE).new
	@mv $(MAKEFILE).new $(MAKEFILE)
	@if	cmp -s $(MAKEFILE) $(MAKEFILE).old ;\
	then	echo "Makefile dependencies unchanged." ;\
	else \
		echo "Makefile dependencies updated." ;\
	fi ;\
	$(RM) -f $(MAKEFILE).old ;
#----------------------------------------------------------------------------
#	RCS info target
#----------------------------------------------------------------------------

rcs_info.local:
	@rcs info

#----------------------------------------------------------------------------
#	Variant targets and conditional macros
#----------------------------------------------------------------------------

build.objdirs: $(OBJDIRS)

$(OBJDIRS):
	test -d $@ || mkdir $@