diff --git a/swlibs/bin/makefile.linux b/swlibs/bin/makefile.linux index 360d40d..9b4d781 100644 --- a/swlibs/bin/makefile.linux +++ b/swlibs/bin/makefile.linux @@ -23,4 +23,4 @@ LDIRT = $(patsubst CVS,,$(patsubst makefile%,,$(wildcard *))) -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak diff --git a/swlibs/binsrc/makefile.linux b/swlibs/binsrc/makefile.linux index ba70c60..59bc113 100644 --- a/swlibs/binsrc/makefile.linux +++ b/swlibs/binsrc/makefile.linux @@ -27,7 +27,7 @@ INSTALL_DESTINATION=$(BUILD_ROOT_SWLIBS) all: target -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak target: $(BINS) $(foreach bin,$(BINS), $(INSTALL) $(bin) $(INSTALL_DESTINATION)/bin) diff --git a/swlibs/fxmemmap/makefile.linux b/swlibs/fxmemmap/makefile.linux index 69d0768..2bf68bb 100644 --- a/swlibs/fxmemmap/makefile.linux +++ b/swlibs/fxmemmap/makefile.linux @@ -30,4 +30,4 @@ INSTALL_DESTINATION = $(BUILD_ROOT_SWLIBS) # targets -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak diff --git a/swlibs/fxmisc/makefile.linux b/swlibs/fxmisc/makefile.linux index 245671c..df2e820 100644 --- a/swlibs/fxmisc/makefile.linux +++ b/swlibs/fxmisc/makefile.linux @@ -34,6 +34,6 @@ CFILES = fx64.c fximg.c fxos.c linutil.c # targets LIBRARIES = libfxmisc.a -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak diff --git a/swlibs/include/make/3dfx.linux.mak b/swlibs/include/make/3dfx.linux.mak index 9825789..4fb617a 100644 --- a/swlibs/include/make/3dfx.linux.mak +++ b/swlibs/include/make/3dfx.linux.mak @@ -78,6 +78,10 @@ DEBUGDEFS = -DGDBG_INFO_ON -DGLIDE_DEBUG GCDEFS = -DENDB -DX11 GCINCS = -I. -I$(BUILD_ROOT_SWLIBS)/include -I$(BUILD_ROOT_HW)/include GCOPTS = -Wall +ifeq "$(FX_GLIDE_PIC)" "1" +GCPTS := $(GCOPTS) -fPIC -DPIC +endif + # # BIG_OPT Indicates O3(?) or better is being used. It changes the # assembly language in grDrawTriangle. Larger optimization removes @@ -147,7 +151,9 @@ default: all all: incs libs bins -OBJECTS = $(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(LIBOBJS) $(AFILES:.s=.o) +# We need to handle asm files with extensions of .s and .S +OBJECTS = $(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(LIBOBJS) \ + $(patsubst %.s,%.o,$(patsubst %.S,%.o,$(AFILES))) #-------------------------------------------------------------------------- # rules for INCS, LIBS, and BINS , the three major targets # @@ -173,8 +179,11 @@ $(LIBRARIES): $(LIBPARTS) $(AR) $*.a $(OBJECTS) ifneq ($(SHARED_LIBRARY),) +SONAME := $(shell echo $(SHARED_LIBRARY) | cut -d "." -f 1-3) +BASENAME := $(shell echo $(SHARED_LIBRARY) | cut -d "." -f 1-2) + $(SHARED_LIBRARY): $(LIBPARTS) $(SUBLIBRARIES) - $(LINK) $(LDFLAGS) -shared -o $(SHARED_LIBRARY) \ + $(LINK) $(LDFLAGS) -shared -Wl,-soname,$(SONAME) -o $(SHARED_LIBRARY) \ -Xlinker --whole-archive \ $(LIBRARIES) $(SUBLIBRARIES) \ -Xlinker --no-whole-archive \ @@ -187,6 +196,12 @@ ifdef INSTALL_DESTINATION $(INSTALL) -m 444 $(LIBRARIES) $(INSTALL_DESTINATION)/lib ifneq "$(SHARED_LIBRARY)" "" $(INSTALL) -m 444 $(SHARED_LIBRARY) $(INSTALL_DESTINATION)/lib + # Create proper symlinks for the shared library so that the binaries + # can link against it. + rm -f $(INSTALL_DESTINATION)/lib/$(SONAME) + ln -s $(SHARED_LIBRARY) $(INSTALL_DESTINATION)/lib/$(SONAME) + rm -f $(INSTALL_DESTINATION)/lib/$(BASENAME) + ln -s $(SONAME) $(INSTALL_DESTINATION)/lib/$(BASENAME) endif else @echo INSTALL_DESTINATION not defined, not installing LIBRARIES diff --git a/swlibs/include/makefile.linux b/swlibs/include/makefile.linux index 11ef236..4aa7799 100644 --- a/swlibs/include/makefile.linux +++ b/swlibs/include/makefile.linux @@ -23,4 +23,4 @@ LDIRT = $(wildcard *.h) -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak diff --git a/swlibs/incsrc/makefile.linux b/swlibs/incsrc/makefile.linux index deec790..cedac18 100644 --- a/swlibs/incsrc/makefile.linux +++ b/swlibs/incsrc/makefile.linux @@ -25,5 +25,5 @@ HEADERS= INSTALL_DESTINATION=$(BUILD_ROOT_SWLIBS) -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak diff --git a/swlibs/lib/makefile.linux b/swlibs/lib/makefile.linux index 728178d..3239e28 100644 --- a/swlibs/lib/makefile.linux +++ b/swlibs/lib/makefile.linux @@ -23,4 +23,4 @@ LDIRT = $(wildcard *.a *.so) -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak diff --git a/swlibs/libsrc/makefile.linux b/swlibs/libsrc/makefile.linux index dc7374f..7df06fd 100644 --- a/swlibs/libsrc/makefile.linux +++ b/swlibs/libsrc/makefile.linux @@ -29,7 +29,7 @@ all: target incs: target -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak target: $(LIBS) $(foreach lib,$(LIBS), $(INSTALL) $(lib) $(INSTALL_DESTINATION)/lib) diff --git a/swlibs/makefile.linux b/swlibs/makefile.linux index 15c0a1f..bc52122 100644 --- a/swlibs/makefile.linux +++ b/swlibs/makefile.linux @@ -26,4 +26,4 @@ THISDIR = swlibs SUBDIRS = incsrc binsrc libsrc bin include lib fxmisc texus fxmemmap \ newpci -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak diff --git a/swlibs/newpci/makefile.linux b/swlibs/newpci/makefile.linux index 96b4894..431be06 100644 --- a/swlibs/newpci/makefile.linux +++ b/swlibs/newpci/makefile.linux @@ -23,4 +23,4 @@ THISDIR = newpci SUBDIRS = pcilib -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak diff --git a/swlibs/newpci/pcilib/makefile.linux b/swlibs/newpci/pcilib/makefile.linux index 793ceb6..23218d3 100644 --- a/swlibs/newpci/pcilib/makefile.linux +++ b/swlibs/newpci/pcilib/makefile.linux @@ -33,4 +33,4 @@ CFILES = fxpci.c fxinfo.c fxmsr.c sst1_pci.c $(EXTPCIFILES) # targets LIBRARIES = libfxpci.a -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak diff --git a/swlibs/texus/cmd/makefile.linux b/swlibs/texus/cmd/makefile.linux index 32e8792..fb53eea 100644 --- a/swlibs/texus/cmd/makefile.linux +++ b/swlibs/texus/cmd/makefile.linux @@ -36,4 +36,4 @@ PROGRAM = texus LLDLIBS = -L$(BUILD_ROOT_SWLIBS)/lib -ltexus -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak diff --git a/swlibs/texus/lib/makefile.linux b/swlibs/texus/lib/makefile.linux index 6aa7a31..c7a1db3 100644 --- a/swlibs/texus/lib/makefile.linux +++ b/swlibs/texus/lib/makefile.linux @@ -42,5 +42,5 @@ LIBRARIES = libtexus.a SHARED_LIBRARY = libtexus.so.1.1 SUBLIBRARIES = $(BUILD_ROOT_SWLIBS)/lib/libfxmisc.a -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak diff --git a/swlibs/texus/makefile.linux b/swlibs/texus/makefile.linux index 533ece6..82d0712 100644 --- a/swlibs/texus/makefile.linux +++ b/swlibs/texus/makefile.linux @@ -21,4 +21,4 @@ THISDIR = texus SUBDIRS = lib -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak diff --git a/swlibs/texus/tests/makefile.linux b/swlibs/texus/tests/makefile.linux index 5c93ede..4a13992 100644 --- a/swlibs/texus/tests/makefile.linux +++ b/swlibs/texus/tests/makefile.linux @@ -30,4 +30,4 @@ CFILES = viewppm.c view3df.c PROGRAMS = $(CFILES:.c=) -include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.mak +include $(BUILD_ROOT_SWLIBS)/include/make/3dfx.linux.mak