Re: packagers note: do not run ld directly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> e.g. a makefile line:
> 
> 	$(LD) -shared -o $@ $(objs)
> 
> should be:	
> 
> 	$(CC) -shared -o $@ $(objs)
> 
> Best practice is to use consistently the flags otherwise passed to
> the compiler, and also use LDFLAGS, i.e.:
> 
> 	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $(objs)

Are you sure CFLAGS should be used?

The default GNU make rules don't do so:

LINK.o = $(CC) $(LDFLAGS) $(TARGET_ARCH)
%: %.o
        $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@


Just for inspiration, I use the following rules in my Makefiles:

%.so.$(SOMAJOR).$(SOMINOR): CFLAGS += -fPIC
%.so.$(SOMAJOR).$(SOMINOR): LDFLAGS += -shared \
        -Wl,-soname,$(patsubst %.so.$(SOMAJOR).$(SOMINOR),%.so.$(SOMAJOR),$@)
%.so.$(SOMAJOR).$(SOMINOR): %.o
        $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@

Regards,
-- 
TJ. (Brno, CZ), BaseOS, Red Hat

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux