$(LT_OBJS): $(HEADERS)
-radeapclient: radeapclient.lo $(CLIENTLIBS)
+## this uses the RLM_CFLAGS and RLM_LIBS and SRCS defs to make TARGET.
+# This needs to be before the radeapclient rule, as the lhs $(EXEECT)
+# expansion is done as soon as the Makefile is loaded
+include ../rules.mak
+
+radeapclient$(EXEEXT): radeapclient.lo $(CLIENTLIBS)
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(RLM_LDFLAGS) -o radeapclient radeapclient.lo $(LIBRADIUS) $(CLIENTLIBS) $(LIBS) $(OPENSSL_LIBS)
radeapclient.lo: radeapclient.c $(HEADERS)
@$(MAKE) $(MFLAGS) X=$(X)rlm_eap/ -C $@ $(WHAT_TO_MAKE)
libeap/$(LIBPREFIX)freeradius-eap.la: libeap
-
-## this uses the RLM_CFLAGS and RLM_LIBS and SRCS defs to make TARGET.
-include ../rules.mak