How to set if else within a flag for a makefile



Do i have any possibility to set if/else within a flag which contains a coupile of libraries. COnsider this example:

FLAG -L$(LIBRAY1_DIR) -L$(LIBRAY2_DIR) -llibrary1 - library2

What i want do to do is for some compilation i want to include the second library - library2 and for other compilation i do not want to include it.

I have done as the following(i am a beginner with Make). But it did not work at all.

FLAG -L$(LIBRAY1_DIR) -L$(LIBRAY2_DIR) \
- library1 \
ifdef$(VARIABLE) \
-llibrary1 \
endif

How can i automazie this action?