diff --git a/res/Makefile b/res/Makefile
index 8084858eebb5b2bf4d2747daa40c716685aa3d9c..3129180e58f910a303d6c406f64d23647b6fe129 100644
--- a/res/Makefile
+++ b/res/Makefile
@@ -29,6 +29,8 @@ ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
   res_agi.so_LIBS:= -lres_speech.so
 endif
 
+res_config_ldap.o: ASTCFLAGS+=-DLDAP_DEPRECATED
+
 ael/ael_lex.o: ael/ael_lex.c ../include/asterisk/ael_structs.h ael/ael.tab.h
 ael/ael_lex.o: ASTCFLAGS+=-I. -Iael -Wno-unused