On Mon, Aug 30, 2021 at 03:35:23PM +0000, REIX, Tony wrote: > Yes, trying to use the create lib$(NAME).exp from $(SHLIB_EXPORTS) when it > exists was my first idea, too. > However, I do not master (or I forgot) this kind of "if...." in a Makefile > and I was unable to find a solution by reading Makefile manuals or by > searching for a similar example. So, I did it in an easier (to me!) and > quicker way: merge with a new command line in the Makefile rule. > Now that we have a clear understanding of what is happenning, I may have a > deeper look at a clean Makefile solution. However, if you know how to manage > this, I would really appreciate some example. I'm asking my colleague too if > he can help me here.
Here's an example from elsewhere in Makefile.shlib: # If SHLIB_EXPORTS is set, the rules below will build a .def file from that. # Else we just use --export-all-symbols. ifeq (,$(SHLIB_EXPORTS)) $(shlib): $(OBJS) | $(SHLIB_PREREQS) $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib) else DLL_DEFFILE = lib$(NAME)dll.def $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS) $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib) UC_NAME = $(shell echo $(NAME) | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') $(DLL_DEFFILE): $(SHLIB_EXPORTS) echo 'LIBRARY LIB$(UC_NAME).dll' >$@ echo 'EXPORTS' >>$@ sed -e '/^#/d' -e 's/^\(.*[ ]\)\([0-9][0-9]*\)/ \1@ \2/' $< >>$@ endif