Changeset 68e0948 in rtems-libbsd


Ignore:
Timestamp:
Oct 23, 2012, 6:31:30 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, 5, 5-freebsd-12, 6-freebsd-12, freebsd-9.3, master
Children:
e26cd8d
Parents:
cc2aec4
Message:

Makefile: Conditionalize IPV6 files and build some commands as .rel

At least ifconfig has "static" global C constructors and you have
to force the objects in.

Location:
freebsd-userspace
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • freebsd-userspace/Makefile

    rcc2aec4 r68e0948  
    8383C_FILES += lib/libc/net/if_nametoindex.c
    8484C_FILES += lib/libc/net/linkaddr.c
     85ifneq ($(DISABLE_IPV6),yes)
    8586C_FILES += lib/libc/net/map_v4v6.c
     87endif
     88# This file is not IPV6 specific
    8689C_FILES += lib/libc/net/name6.c
    8790C_FILES += lib/libc/net/rcmd.c
     
    103106C_FILES += lib/libc/resolv/mtctxres.c
    104107C_FILES += lib/libc/string/strsep.c
     108C_FILES += lib/libc/stdlib/strtonum.c
    105109
    106110C_FILES += lib/libc/isc/ev_streams.c
     
    169173# ping command sources
    170174C_FILES += commands/sbin/ping/ping.c
     175ifneq ($(DISABLE_IPV6),yes)
    171176C_FILES += commands/sbin/ping6/ping6.c
     177endif
    172178
    173179# route command sources
     
    193199
    194200# ifconfig command sources
    195 C_FILES += commands/sbin/ifconfig/af_atalk.c
    196 C_FILES += commands/sbin/ifconfig/af_inet.c
    197 C_FILES += commands/sbin/ifconfig/af_link.c
    198 C_FILES += commands/sbin/ifconfig/ifbridge.c
    199 C_FILES += commands/sbin/ifconfig/ifclone.c
    200 C_FILES += commands/sbin/ifconfig/ifgif.c
    201 C_FILES += commands/sbin/ifconfig/ifgroup.c
    202 C_FILES += commands/sbin/ifconfig/iflagg.c
    203 C_FILES += commands/sbin/ifconfig/ifmedia.c
    204 C_FILES += commands/sbin/ifconfig/ifvlan.c
    205 C_FILES += commands/sbin/ifconfig/af_inet6.c
    206 C_FILES += commands/sbin/ifconfig/af_nd6.c
    207 C_FILES += commands/sbin/ifconfig/ifcarp.c
    208 C_FILES += commands/sbin/ifconfig/ifconfig.c
    209 C_FILES += commands/sbin/ifconfig/ifgre.c
    210 C_FILES += commands/sbin/ifconfig/ifieee80211.c
    211 C_FILES += commands/sbin/ifconfig/ifmac.c
    212 C_FILES += commands/sbin/ifconfig/ifpfsync.c
     201# UNUSED IFCONFIG_C_FILES += commands/sbin/ifconfig/af_atalk.c
     202IFCONFIG_C_FILES += commands/sbin/ifconfig/af_inet.c
     203IFCONFIG_C_FILES += commands/sbin/ifconfig/af_link.c
     204IFCONFIG_C_FILES += commands/sbin/ifconfig/ifbridge.c
     205IFCONFIG_C_FILES += commands/sbin/ifconfig/ifclone.c
     206IFCONFIG_C_FILES += commands/sbin/ifconfig/ifgif.c
     207IFCONFIG_C_FILES += commands/sbin/ifconfig/ifgroup.c
     208IFCONFIG_C_FILES += commands/sbin/ifconfig/iflagg.c
     209IFCONFIG_C_FILES += commands/sbin/ifconfig/ifmedia.c
     210IFCONFIG_C_FILES += commands/sbin/ifconfig/ifvlan.c
     211ifneq ($(DISABLE_IPV6),yes)
     212IFCONFIG_C_FILES += commands/sbin/ifconfig/af_inet6.c
     213IFCONFIG_C_FILES += commands/sbin/ifconfig/af_nd6.c
     214endif
     215IFCONFIG_C_FILES += commands/sbin/ifconfig/ifcarp.c
     216IFCONFIG_C_FILES += commands/sbin/ifconfig/ifconfig.c
     217IFCONFIG_C_FILES += commands/sbin/ifconfig/ifgre.c
     218# UNUSED IFCONFIG_C_FILES += commands/sbin/ifconfig/ifieee80211.c
     219# UNUSED IFCONFIG_C_FILES += commands/sbin/ifconfig/ifmac.c
     220IFCONFIG_C_FILES += commands/sbin/ifconfig/ifpfsync.c
    213221
    214222# The following two files were left out to avoid
     
    223231# netstat command sources
    224232# no need to support AppleTalk yet
    225 # C_FILES += commands/usr.bin/netstat/atalk.c
    226 C_FILES += commands/usr.bin/netstat/bpf.c
    227 C_FILES += commands/usr.bin/netstat/if.c
    228 C_FILES += commands/usr.bin/netstat/inet6.c
    229 C_FILES += commands/usr.bin/netstat/inet.c
    230 C_FILES += commands/usr.bin/netstat/ipsec.c
     233# NETSTAT_C_FILES += commands/usr.bin/netstat/atalk.c
     234NETSTAT_C_FILES += commands/usr.bin/netstat/bpf.c
     235NETSTAT_C_FILES += commands/usr.bin/netstat/if.c
     236ifneq ($(DISABLE_IPV6),yes)
     237NETSTAT_C_FILES += commands/usr.bin/netstat/inet6.c
     238endif
     239NETSTAT_C_FILES += commands/usr.bin/netstat/inet.c
     240NETSTAT_C_FILES += commands/usr.bin/netstat/ipsec.c
    231241# no need to support IPX yet
    232 # C_FILES += commands/usr.bin/netstat/ipx.c
    233 C_FILES += commands/usr.bin/netstat/main.c
     242# NETSTAT_C_FILES += commands/usr.bin/netstat/ipx.c
     243NETSTAT_C_FILES += commands/usr.bin/netstat/main.c
    234244# XXX does not compile yet
    235 C_FILES += commands/usr.bin/netstat/mbuf.c
    236 C_FILES += commands/usr.bin/netstat/mroute6.c
    237 C_FILES += commands/usr.bin/netstat/mroute.c
     245NETSTAT_C_FILES += commands/usr.bin/netstat/mbuf.c
     246ifneq ($(DISABLE_IPV6),yes)
     247NETSTAT_C_FILES += commands/usr.bin/netstat/mroute6.c
     248endif
     249NETSTAT_C_FILES += commands/usr.bin/netstat/mroute.c
    238250# Disable netgraph support - this is a long thread to pull
    239 # C_FILES += commands/usr.bin/netstat/netgraph.c
    240 C_FILES += commands/usr.bin/netstat/pfkey.c
     251# NETSTAT_C_FILES += commands/usr.bin/netstat/netgraph.c
     252NETSTAT_C_FILES += commands/usr.bin/netstat/pfkey.c
    241253# Actually just route.c in FreeBSD
    242 C_FILES += commands/usr.bin/netstat/netstat_route.c
    243 C_FILES += commands/usr.bin/netstat/sctp.c
    244 C_FILES += commands/usr.bin/netstat/unix.c
     254NETSTAT_C_FILES += commands/usr.bin/netstat/netstat_route.c
     255NETSTAT_C_FILES += commands/usr.bin/netstat/sctp.c
     256NETSTAT_C_FILES += commands/usr.bin/netstat/unix.c
    245257
    246258C_O_FILES = $(C_FILES:%.c=%.o)
    247259C_D_FILES = $(C_FILES:%.c=%.d)
    248260
     261IFCONFIG_C_O_FILES = $(IFCONFIG_C_FILES:%.c=%.o)
     262IFCONFIG_C_D_FILES = $(IFCONFIG_C_FILES:%.c=%.d)
     263
     264NETSTAT_C_O_FILES = $(NETSTAT_C_FILES:%.c=%.o)
     265NETSTAT_C_D_FILES = $(NETSTAT_C_FILES:%.c=%.d)
     266
    249267LIB = libbsdc.a
     268IFCONFIG = commands/sbin/ifconfig/ifconfig.rel
     269NETSTAT = commands/usr.bin/netstat/netstat.rel
     270
     271COMMAND_RELS = $(NETSTAT) $(IFCONFIG)
     272
    250273GEN_FILES = include/rpc/rpcb_prot.h
    251274GEN_FILES += commands/sbin/route/keywords.h
     
    262285EXTRA_CLEAN += lib/libipsec/y.tab.h
    263286
    264 all: $(LIB)
    265 
    266 $(LIB): $(GEN_FILES) $(C_O_FILES)
     287all: $(LIB) 
     288
     289$(LIB): $(GEN_FILES) $(C_O_FILES) $(COMMAND_RELS)
    267290        $(AR) rcu $@ $^
     291
     292$(IFCONFIG): $(IFCONFIG_C_O_FILES)
     293        $(LD) -r -o $@ $^
     294
     295$(NETSTAT): $(NETSTAT_C_O_FILES)
     296        $(LD) -r -o $@ $^
    268297
    269298include/rpc/rpcb_prot.h: include/rpc/rpcb_prot.x
     
    308337
    309338clean:
    310         rm -f $(LIB) $(C_O_FILES) $(C_D_FILES) $(GEN_FILES) $(CLEAN_FILES)
     339        rm -f $(LIB) $(GEN_FILES) $(CLEAN_FILES)
     340        rm -f $(C_O_FILES) $(IFCONFIG_C_O_FILES) $(NETSTAT_C_O_FILES)
     341        rm -f $(C_D_FILES) $(IFCONFIG_C_D_FILES) $(NETSTAT_C_D_FILES)
    311342
    312343-include $(C_D_FILES)
  • freebsd-userspace/lib/libc/net/gethostbydns.c

    rcc2aec4 r68e0948  
    341341#else
    342342                        he->h_name = bp;
     343#ifdef INET6
    343344                        if (statp->options & RES_USE_INET6) {
    344345                                n = strlen(bp) + 1;     /* for the \0 */
     
    350351                                _map_v4v6_hostent(he, &bp, ep);
    351352                        }
     353#endif
    352354                        RES_SET_H_ERRNO(statp, NETDB_SUCCESS);
    353355                        return (0);
     
    425427                        bp += n;
    426428                }
     429#ifdef INET6
    427430                if (statp->options & RES_USE_INET6)
    428431                        _map_v4v6_hostent(he, &bp, ep);
     432#endif
    429433                RES_SET_H_ERRNO(statp, NETDB_SUCCESS);
    430434                return (0);
     
    700704        hed->h_addr_ptrs[0] = (char *)hed->host_addr;
    701705        hed->h_addr_ptrs[1] = NULL;
     706#ifdef INET6
    702707        if (af == AF_INET && (statp->options & RES_USE_INET6)) {
    703708                _map_v4v6_address((char*)hed->host_addr, (char*)hed->host_addr);
     
    705710                he.h_length = NS_IN6ADDRSZ;
    706711        }
     712#endif
    707713        if (__copy_hostent(&he, hptr, buffer, buflen) != 0) {
    708714                *errnop = errno;
  • freebsd-userspace/lib/libc/net/gethostbyht.c

    rcc2aec4 r68e0948  
    116116                goto again;
    117117        *cp++ = '\0';
     118#ifdef INET6
    118119        if (inet_pton(AF_INET6, p, hed->host_addr) > 0) {
    119120                af = AF_INET6;
     
    132133                goto again;
    133134        }
     135#else
     136        if (inet_pton(AF_INET, p, hed->host_addr) > 0) {
     137                af = AF_INET;
     138                len = INADDRSZ;
     139        }
     140#endif
    134141        hed->h_addr_ptrs[0] = (char *)hed->host_addr;
    135142        hed->h_addr_ptrs[1] = NULL;
     
    194201                return (-1);
    195202        }
     203#ifdef INET6
    196204        if (gethostent_p(&he, hed, statp->options & RES_USE_INET6, statp) != 0)
    197205                return (-1);
     206#endif
    198207        if (__copy_hostent(&he, hptr, buffer, buflen) != 0) {
    199208                RES_SET_H_ERRNO(statp, NETDB_INTERNAL);
     
    255264                if (he.h_addrtype != af)
    256265                        continue;
     266#ifdef INET6
    257267                if (he.h_addrtype == AF_INET &&
    258268                    statp->options & RES_USE_INET6) {
     
    261271                        he.h_addrtype = AF_INET6;
    262272                }
     273#endif
    263274                if (strcasecmp(he.h_name, name) == 0)
    264275                        break;
     
    318329        _sethosthtent(0, hed);
    319330        while ((error = gethostent_p(&he, hed, 0, statp)) == 0)
     331#ifdef INET6
    320332                if (he.h_addrtype == af && !bcmp(he.h_addr, addr, len)) {
    321333                        if (he.h_addrtype == AF_INET &&
     
    327339                        break;
    328340                }
     341#endif
    329342        _endhosthtent(hed);
    330343
  • freebsd-userspace/lib/libc/net/gethostnamadr.c

    rcc2aec4 r68e0948  
    459459        strncpy(hed->hostbuf, name, MAXDNAME);
    460460        hed->hostbuf[MAXDNAME] = '\0';
     461#ifdef INET6
    461462        if (af == AF_INET && (statp->options & RES_USE_INET6) != 0U) {
    462463                _map_v4v6_address((char *)hed->host_addr,
     
    464465                af = AF_INET6;
    465466        }
     467#endif
    466468        he.h_addrtype = af;
    467469        switch(af) {
     
    469471                he.h_length = NS_INADDRSZ;
    470472                break;
     473#ifdef INET6
    471474        case AF_INET6:
    472475                he.h_length = NS_IN6ADDRSZ;
    473476                break;
     477#endif
    474478        default:
    475479                errno = EAFNOSUPPORT;
Note: See TracChangeset for help on using the changeset viewer.