--- src/Makefile.in	2009-06-14 15:18:52.000000000 -0700
+++ src/Makefile.in	2025-07-13 18:44:23.000000000 +0800
@@ -82,11 +82,12 @@
 #
 MPATH=-DMUD_LIB='"$(MUD_LIB)"' -DBINDIR='"$(BINDIR)"' -DERQ_DIR='"$(ERQ_DIR)"'
 #
-CFLAGS= @EXTRA_CFLAGS@ $(OPTIMIZE) $(DEBUG) $(WARN) $(MPATH) $(PROFIL)
+CFLAGS += @EXTRA_CFLAGS@ $(OPTIMIZE) $(DEBUG) $(WARN) $(MPATH) $(PROFIL)
+CPPFLAGS += @CPPFLAGS@
 #
-LIBS=@LIBS@ @PKGLIBS@
+LIBS += @LIBS@ @PKGLIBS@
 #
-LDFLAGS=$(PROFIL) @LDFLAGS@
+LDFLAGS += $(PROFIL) @LDFLAGS@
 #
 #Note that, if you use smalloc/slaballoc with MALLOC_SBRK (which is the 
 #default) and sbkr() (SBRK_OK) is available, and you don't link statically,
@@ -137,13 +138,13 @@
 	@echo "To install everything in one go, use 'make install-all'."
 
 install-driver: ldmud@EXEEXT@ docs
-	$(mkinstalldirs) $(BINDIR) $(MANDIR)/man1
-	$(INSTALL) -c ldmud@EXEEXT@ $(BINDIR)/ldmud@EXEEXT@
-	$(INSTALL) -c ../doc/man/ldmud.1 $(MANDIR)/man1/ldmud.1
+	$(mkinstalldirs) $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
+	$(INSTALL) -c ldmud@EXEEXT@ $(DESTDIR)$(BINDIR)/ldmud@EXEEXT@
+	$(INSTALL) -c ../doc/man/ldmud.1 $(DESTDIR)$(MANDIR)/man1/ldmud.1
 
 install-headers: 
-	$(mkinstalldirs) $(MUD_LIB_INCLUDE)
-	$(INSTALL) -c ../mudlib/sys/* $(MUD_LIB_INCLUDE)
+	$(mkinstalldirs) $(DESTDIR)$(MUD_LIB_INCLUDE)
+	$(INSTALL) -c ../mudlib/sys/* $(DESTDIR)$(MUD_LIB_INCLUDE)
 
 install-utils:
 	(cd util; $(MAKE) $(MFLAGS) install)
