Annotation of dietlibc/Makefile, revision 1.32

1.25      fefe        1: ARCH=$(shell uname -m | sed 's/i[4-9]86/i386/')
                      2: 
                      3: OBJDIR=bin-$(ARCH)
1.1       cvs         4: 
1.31      fefe        5: all: $(OBJDIR) $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a $(OBJDIR)/librpc.a $(OBJDIR)/elftrunc $(OBJDIR)/diet
1.1       cvs         6: 
                      7: CFLAGS=-pipe
                      8: CROSS=
                      9: 
1.16      fefe       10: CC=gcc
                     11: 
1.31      fefe       12: VPATH=lib:libstdio:libugly:libcruft:libcrypt:libshell:liblatin1:librpc:syscalls.c
1.1       cvs        13: 
1.25      fefe       14: SYSCALLOBJ=$(patsubst syscalls.s/%.S,$(OBJDIR)/%.o,$(wildcard syscalls.s/*.S))
1.1       cvs        15: 
1.25      fefe       16: LIBOBJ=$(patsubst lib/%.c,$(OBJDIR)/%.o,$(wildcard lib/*.c))
                     17: LIBUGLYOBJ=$(patsubst libugly/%.c,$(OBJDIR)/%.o,$(wildcard libugly/*.c))
                     18: LIBSTDIOOBJ=$(patsubst libstdio/%.c,$(OBJDIR)/%.o,$(wildcard libstdio/*.c))
                     19: LIBCRUFTOBJ=$(patsubst libcruft/%.c,$(OBJDIR)/%.o,$(wildcard libcruft/*.c))
                     20: LIBCRYPTOBJ=$(patsubst libcrypt/%.c,$(OBJDIR)/%.o,$(wildcard libcrypt/*.c))
                     21: LIBSHELLOBJ=$(patsubst libshell/%.c,$(OBJDIR)/%.o,$(wildcard libshell/*.c))
1.1       cvs        22: 
1.31      fefe       23: LIBRPCOBJ=$(patsubst librpc/%.c,$(OBJDIR)/%.o,$(wildcard librpc/*.c))
                     24: 
1.1       cvs        25: include $(ARCH)/Makefile.add
                     26: 
                     27: ifeq ($(CFLAGS),-pipe)
                     28: CFLAGS+=-O -fomit-frame-pointer
                     29: endif
                     30: 
1.28      fefe       31: ifneq ($(DEBUG),)
                     32: CFLAGS = -g
                     33: COMMENT = :
                     34: endif
1.31      fefe       35: CFLAGS += -Wall -Wno-switch
1.1       cvs        36: 
1.14      fefe       37: PWD=$(shell pwd)
                     38: 
1.1       cvs        39: .SUFFIXES:
                     40: .SUFFIXES: .S .c
                     41: 
1.25      fefe       42: $(OBJDIR):
                     43:        mkdir $@
                     44: 
1.2       olaf       45: % :: %,v
1.1       cvs        46: 
1.25      fefe       47: $(OBJDIR)/%.o: %.S
                     48:        $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $< -o $@
1.1       cvs        49: 
1.25      fefe       50: $(OBJDIR)/%.o: %.c
                     51:        $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $< -o $@
1.28      fefe       52:        $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@
1.1       cvs        53: 
1.5       fefe       54: DIETLIBC_OBJ = $(SYSCALLOBJ) $(LIBOBJ) $(LIBSTDIOOBJ) $(LIBUGLYOBJ) \
1.23      fefe       55: $(LIBCRUFTOBJ) $(LIBCRYPTOBJ) $(LIBSHELLOBJ) \
1.25      fefe       56: $(OBJDIR)/__longjmp.o $(OBJDIR)/setjmp.o $(OBJDIR)/unified.o \
                     57: $(OBJDIR)/mmap.o $(OBJDIR)/clone.o
1.1       cvs        58: 
1.25      fefe       59: $(OBJDIR)/dietlibc.a: $(DIETLIBC_OBJ) $(OBJDIR)/start.o
                     60:        $(CROSS)ar cru $@ $(DIETLIBC_OBJ)
1.31      fefe       61: 
1.32    ! fefe       62: $(OBJDIR)/librpc.a: $(LIBRPCOBJ)
1.31      fefe       63:        $(CROSS)ar cru $@ $(LIBRPCOBJ)
1.17      fefe       64: 
1.25      fefe       65: LIBLATIN1_OBJS=$(patsubst liblatin1/%.c,$(OBJDIR)/%.o,$(wildcard liblatin1/*.c))
                     66: $(OBJDIR)/liblatin1.a: $(LIBLATIN1_OBJS)
1.17      fefe       67:        $(CROSS)ar cru $@ $^
1.1       cvs        68: 
1.25      fefe       69: $(OBJDIR)/libdietc.so: $(OBJDIR)/dietlibc.a
1.1       cvs        70:        $(CROSS)ld -whole-archive -shared -o $@ $^
                     71: 
                     72: $(SYSCALLOBJ): syscalls.h
                     73: 
1.25      fefe       74: $(OBJDIR)/elftrunc: contrib/elftrunc.c $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a
1.16      fefe       75:        $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^
1.1       cvs        76: 
1.25      fefe       77: $(OBJDIR)/diet: diet.c $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a
                     78:        $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(PWD)\"
1.26      fefe       79:        $(CROSS)strip -R .comment -R .note $@
1.25      fefe       80: 
                     81: $(OBJDIR)/djb: $(OBJDIR)/compile $(OBJDIR)/load
1.1       cvs        82: 
1.25      fefe       83: $(OBJDIR)/compile:
                     84:        echo 'exec gcc $(CFLAGS) -I$(PWD)/$(OBJDIR)/include -c $${1+"$$@"}' > $@
1.1       cvs        85:        chmod 755 $@
                     86: 
1.25      fefe       87: $(OBJDIR)/load:
                     88:        echo 'main="$$1"; shift; exec gcc -nostdlib -o "$$main" $(PWD)/$(OBJDIR)/start.o "$$main".o $${1+"$$@"} $(PWD)/$(OBJDIR)/dietlibc.a -lgcc'  > $@
1.1       cvs        89:        chmod 755 $@
                     90: 
                     91: clean:
                     92:        rm -f *.o *.a t t1 compile load elftrunc exports mapfile libdietc.so
1.25      fefe       93:        rm -rf bin-*
1.1       cvs        94:        $(MAKE) -C examples clean
                     95: 
                     96: tar: clean
1.11      fefe       97:        rm -f armv4l
1.3       fefe       98:        ln -sf arm armv4l
1.8       fefe       99:        cd ..; tar cvvf dietlibc.tar.bz2 dietlibc --use=bzip2 --exclude CVS
1.1       cvs       100: 
1.25      fefe      101: $(OBJDIR)/exports: $(OBJDIR)/dietlibc.a
                    102:        nm -g $(OBJDIR)/dietlibc.a | grep -w T | awk '{ print $$3 }' | sort -u > $(OBJDIR)/exports
1.1       cvs       103: 
                    104: .PHONY: t t1
                    105: t:
1.25      fefe      106:        $(CROSS)$(CC) -g $(CFLAGS) -fno-builtin -nostdlib -Iinclude -o t t.c $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a -lgcc -Wl,-Map,mapfile
1.1       cvs       107: 
                    108: t1:
1.16      fefe      109:        $(CROSS)$(CC) -g -o t1 t.c
1.1       cvs       110: 
1.27      fefe      111: install: $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a $(OBJDIR)/elftrunc $(OBJDIR)/diet
                    112:        cp $(OBJDIR)/start.o $(INSTALLPREFIX)$(prefix)/lib/dietstart.o
                    113:        cp $(OBJDIR)/dietlibc.a $(INSTALLPREFIX)$(prefix)/lib/libdietc.a
                    114:        cp $(OBJDIR)/liblatin1.a $(INSTALLPREFIX)$(prefix)/lib/libdietlatin1.a
                    115:        cp $(OBJDIR)/diet $(INSTALLPREFIX)$(prefix)/bin/diet
1.1       cvs       116: 
                    117: .PHONY: sparc ppc mips arm alpha i386
                    118: 
1.19      fefe      119: arm sparc ppc alpha i386:
1.25      fefe      120:        $(MAKE) ARCH=$@ CROSS=$@-linux- all t bin-$@/libdietc.so
1.1       cvs       121: 
1.19      fefe      122: mips:
1.25      fefe      123:        $(MAKE) ARCH=$@ CROSS=$@-linux-gnu- all t bin-$@/libdietc.so
1.1       cvs       124: 
1.25      fefe      125: cross:
                    126:        $(MAKE) arm sparc ppc alpha i386 mips
1.15      fefe      127: 
                    128: 
                    129: # these depend on dietfeatures.h for large file backward compatibility
                    130: __fstat64.o __lstat64.o __stat64.o: dietfeatures.h
                    131: 
                    132: # these depend on dietfeatures.h for thread support
1.24      olaf      133: alloc.o perror.o logging.o unified.o: dietfeatures.h
1.15      fefe      134: 
                    135: # these depend on dietfeatures.h for linker warnings
                    136: assert_fail.o sprintf.o vsnprintf.o ___div.o fflush.o setvbuf.o system.o sendfile.o: dietfeatures.h
                    137: 
                    138: # these depend on dietfeatures.h for buffered stdio
                    139: fclose.o fdglue.o fflush.o fgetc.o fputc.o fread.o fseek.o: dietfeatures.h
                    140: printf.o setvbuf.o stderr.o stdin.o stdout.o fwrite.o: dietfeatures.h
                    141: 
                    142: # these depend on dietfeatures.h for fast string routines
                    143: strcasecmp.o strcat.o strchr.o strcmp.o strcpy.o strlen.o: dietfeatures.h
                    144: strncasecmp.o strncat.o strrchr.o: dietfeatures.h
                    145: 
                    146: # these depend on dietfeatures.h for /proc
                    147: tty.o: dietfeatures.h
                    148: 
                    149: # these depend on dietfeatures.h for ungetc support ;-)
                    150: ungetc.o: dietfeatures.h
                    151: 
1.18      fefe      152: # these depend on dietfeatures.h for WANT_TZFILE_PARSER
                    153: localtime_r.o: dietfeatures.h
1.29      fefe      154: 
                    155: r: r.c
                    156:        $(CROSS)$(CC) -g $(CFLAGS) -fno-builtin -nostdlib -Iinclude -o r r.c $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a -lgcc -Wl,-Map,mapfile

LinuxTV legacy CVS <linuxtv.org/cvs>