diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-21 21:41:34 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-21 21:41:34 +0000 |
commit | a5fdebc5f6375078ec1763850a4ca23ec7fe6458 (patch) | |
tree | bcf0a25c3d45a209a6e3ac37b233a4812f29c732 /include/makeinclude/rules.lib.GNU | |
download | ATCD-a5fdebc5f6375078ec1763850a4ca23ec7fe6458.tar.gz |
Initial revision
Diffstat (limited to 'include/makeinclude/rules.lib.GNU')
-rw-r--r-- | include/makeinclude/rules.lib.GNU | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/include/makeinclude/rules.lib.GNU b/include/makeinclude/rules.lib.GNU new file mode 100644 index 00000000000..f28213810a0 --- /dev/null +++ b/include/makeinclude/rules.lib.GNU @@ -0,0 +1,113 @@ +#---------------------------------------------------------------------------- +# @(#)rules.lib.GNU 1.1 10/18/96 +# +# Build libraries (i.e., contain no binary executables) +# GNU version +# Requires GNU make +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# The following targets arrange to build both unshared and shared libraries +#---------------------------------------------------------------------------- + +VSHLIB = $(SHLIB:%.so=%$(VAR).so) +VOBJS = $(LSRC:%.cpp=$(VDIR)%.o) + +ifdef TEMPINCDIR +VSHOBJS1 = +else +LSRC += $(LSRC2) +ifdef PRELIB +VSHOBJS = $(LSRC:%.cpp=$(VSHDIR)%.so) +VSHOBJS1 = $(VSHOBJS) +else +VSHOBJS = $(LSRC:%.cpp=$(VSHDIR)%.so) +VSHOBJS1 = $(LSRC:%.cpp=$(VSHDIR)%.o) +endif +endif + +# Comment out for now... +# $(DEFS:%=$(INSINC)/%) \ + +INSTALL = $(VLIB:%.a=$(INSLIB)/%.a) \ + $(VSHLIB:%.so=$(INSLIB)/%.so) + +ifdef PRELIB +# Unfortunately, gcc has to do a link of all of the objects (during which +# it may decide to recompile some of the objects), before we can safely build +# any libraries or shared objects. Comment this line if no shared +# libraries or objects are used. +$(VSHOBJS): $(VSHLIB) +endif + +# Comment these lines out if you want to build both *.a and *.so libraries... +#$(VSHLIB): $(VSHOBJS) $(STATLIB) +#ifdef PRELIB +# $(PRELIB) +#endif +# $(SOLINK.cc) -o $@ $(LDFLAGS) $(VSHDIR)*.o + +# Uncomment the remaining lines if you want to build both *.a and *.so libraries... +VLIB = $(LIB:%.a=%$(VAR).a) + +$(VLIB): $(VOBJS) +ifdef PRELIB + $(PRELIB) +endif + $(AR) $(ARFLAGS) $@ $? +ifdef TEMPINCDIR +# This is required for AIX!!! + if test -e xxx; \ + then \ + rm xxx; \ + fi + (if test -s ./$(TEMPINCDIR)/*.C; \ + then \ + while ! test -e xxx; \ + do \ + touch xxx; \ + cd ./$(TEMPINCDIR); \ + for temp in *.C; \ + do \ + if ! test -d ./$(TEMPINCDIR); \ + then \ + cd ..; \ + fi; \ + if $(COMPILE.cc) -o $(VDIR)$$temp.o ./$(TEMPINCDIR)/$$temp; \ + then \ + $(AR) $(ARFLAGS) $@ $(VDIR)$$temp.o;\ + else \ + rm $@; \ + rm xxx; \ + exit; \ + fi \ + done; \ + for temp in ./$(TEMPINCDIR)/*.C; \ + do \ + if test $$temp -nt xxx; \ + then \ + rm xxx; \ + break; \ + fi \ + done \ + done; \ + fi) + rm xxx +endif + -chmod a+r $@ + -$(RANLIB) $@ + +# Note that if you don't want to build shared libraries, just remove the $(VSHOBJS) +$(VSHLIB): $(VSHOBJS) $(STATLIB) +ifdef PRELIB + $(PRELIB) +endif + $(SOLINK.cc) -o $@ $(VSHOBJS1) $(LDFLAGS) $(LIBS) $(STATLIB) + -chmod a+rx $@ + +ifdef SHLIBA +$(SHLIBA): $(VSHLIB) + $(AR) $(ARFLAGS) $@ $? + -chmod a+rx $@ + -$(RANLIB) $@ +endif |