Annotation of dietlibc/Makefile, revision 1.33

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