# Link
-LDFLAGS_COMMON=-lm -ldl
+# LordHavoc note: I have been informed that system libraries must come last
+# on the linker line, and that -lm must always be last
+LDFLAGS_COMMON=-ldl -lm
LDFLAGS_DEBUG=-g -ggdb
LDFLAGS_PROFILE=-g -pg
LDFLAGS_RELEASE=
GLX_LIB=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm $(SOUNDLIB)
-DO_LD=$(CC) -o $@ $^ $(LDFLAGS)
+DO_LD=$(CC) $(LDFLAGS) -o $@ $^
##### Commands #####
# @echo
$(MAKE) $(EXE) \
CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\
- LDFLAGS="$(LDFLAGS_COMMON) $(LDFLAGS_DEBUG)"
+ LDFLAGS="$(LDFLAGS_DEBUG)"
bin-profile :
@echo
# @echo
$(MAKE) $(EXE) \
CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\
- LDFLAGS="$(LDFLAGS_COMMON) $(LDFLAGS_PROFILE)"
+ LDFLAGS="$(LDFLAGS_PROFILE)"
bin-release :
@echo
# @echo
$(MAKE) $(EXE) \
CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\
- LDFLAGS="$(LDFLAGS_COMMON) $(LDFLAGS_RELEASE)"
+ LDFLAGS="$(LDFLAGS_RELEASE)"
builddate:
touch builddate.c
$(EXE_GLX): $(OBJ_COMMON) $(OBJ_GLX)
# @echo " Linking " $@
- $(DO_LD) $(GLX_LIB)
+ $(DO_LD) $(GLX_LIB) $(LDFLAGS_COMMON)
$(EXE_DED): $(OBJ_COMMON) $(OBJ_DED)
# @echo " Linking " $@
- $(DO_LD)
+ $(DO_LD) $(LDFLAGS_COMMON)
clean:
rm -f $(EXE_GLX) $(EXE_DED) *.o *.d