head	1.1;
branch	1.1.1;
access;
symbols
	LIBC_4_5_19:1.1.1.3
	LIBC_4_5_18:1.1.1.3
	LIBC_4_5_17:1.1.1.3
	LIBC_4_5_16:1.1.1.3
	LIBC_4_5_15:1.1.1.3
	LIBC_4_5_14:1.1.1.3
	LIBC_4_5_13:1.1.1.3
	LIBC_4_5_12:1.1.1.3
	LIBC_4_5_11:1.1.1.3
	LIBC_4_5_10:1.1.1.2
	LIBC_4_5_9:1.1.1.1
	LIBC_4_5_8:1.1.1.1
	LIBC_4_5_7:1.1.1.1
	LIBC:1.1.1;
locks; strict;
comment	@# @;


1.1
date	93.12.14.16.58.37;	author steinber;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	93.12.14.16.58.38;	author steinber;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	94.01.13.12.12.32;	author steinber;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	94.01.19.16.22.57;	author steinber;	state Exp;
branches;
next	;


desc
@@



1.1
log
@Initial revision
@
text
@#
# Makefile for the Linux C library
#

include ./Makeconfig

# What we want to do by default.
TARGET=lib

# for cleanup
CLEANLIBS= libc.a libm.a libtermcap.a libcurses.a libg.a libc_p.a \
	libmcheck.a libdbm.a libcompat.a libgcc.a libgmon.a libbsd.a \
	libalias.a libmalias.a libyp.a libieee.a libgcc3.a

CLEANDIRS= crt bsd cvt ctype curses dirent gdbm gmon grp inet io \
	libio locale login malloc math misc mntent posix pwd regex \
	rpc setjmp signal stdlib string sysdeps termcap time ufc \
	compat gcc libbsd malloc-930716 sbin yp jump $(NLSDIR)
#	jumptable1 jumptable2

ifdef DEBUG

LIBS:= $(LIB) libmcheck.a

# for debug library
DIRS = bsd cvt ctype dirent grp inet io libio locale login \
	malloc misc mntent posix pwd regex rpc setjmp signal stdlib \
	string sysdeps time ufc $(YPDIR) $(NLSDIR) # jumptable1 jumptable2

endif

ifdef CHECKER

LIBS:= libc.a libgcc.a 
LIBS:= libc.a 

# for checker library
DIRS = crt bsd cvt ctype dirent grp inet io libio locale login \
	math misc mntent posix pwd regex rpc setjmp signal stdlib \
	string sysdeps time ufc $(YPDIR) $(NLSDIR) gcc # jumptable1 jumptable2

endif

ifdef PROFILE

# for profile library

LIBS:= $(LIB) libgmon.a

DIRS = bsd crt cvt ctype dirent gmon grp inet io libio locale \
	login malloc-930716 misc mntent posix pwd regex rpc setjmp \
	signal stdlib string sysdeps time ufc $(YPDIR) $(NLSDIR) # jumptable1 jumptable2

endif

ifdef STATIC

ifeq "$(LIBYP)" "libc"

LIBS	= libc.a libm.a libtermcap.a libcurses.a \
	libdbm.a libbsd.a libieee.a # libgcc.a

else

LIBS	= libc.a libm.a libtermcap.a libcurses.a \
	libdbm.a libbsd.a libieee.a $(REALLIBYP) # libgcc.a

endif

# for static library
DIRS = crt bsd cvt ctype curses dirent gdbm grp inet io libio \
	locale login malloc-930716 math misc mntent posix pwd regex \
	rpc setjmp signal stdlib string sysdeps termcap time ufc \
	libbsd gcc $(YPDIR) $(NLSDIR) # jumptable1 jumptable2

endif

ifdef MATH

ifdef SHARED

LIBS	= libm.a libmalias.a
LIBMALIAS=yes

# for math library 
DIRS = math sysdeps gcc 

else

LIBS	= libm.a

# for math library 
DIRS = math sysdeps

endif

JUMP_LIB=libm
JUMP_DIR:=./jump/$(SHLIB)

STUBNAMES=libm

SYSLIBS=libgcc3.a -lc

endif

ifdef SHARED

ifndef MATH

ifeq "$(LIBYP)" "libc"

LIBS	= libc.a libtermcap.a libcurses.a \
	libdbm.a libcompat.a libalias.a libgcc.a
LIBS	= libc.a libtermcap.a libcurses.a \
	libdbm.a libcompat.a libalias.a libgcc3.a

else

LIBS	= libc.a libtermcap.a libcurses.a \
	libdbm.a libcompat.a libalias.a $(REALLIBYP) # libgcc.a
LIBS	= libc.a libtermcap.a libcurses.a \
	libdbm.a libcompat.a libalias.a $(REALLIBYP) libgcc3.a

endif

# for shared library 
DIRS = bsd cvt ctype curses dirent gdbm grp inet io \
	libio locale login malloc-930716 misc mntent posix pwd regex \
	rpc setjmp signal stdlib string sysdeps termcap time ufc \
	compat gcc $(YPDIR) $(NLSDIR) # jumptable1 jumptable2

SHAREDLIBGCC1OBJS= _mulsi3.o _udivsi3.o _divsi3.o _umodsi3.o _modsi3.o _lshrsi3.o \
	_lshlsi3.o _ashrsi3.o _ashlsi3.o _divdf3.o _muldf3.o _negdf2.o _adddf3.o \
	_subdf3.o _fixdfsi.o _fixsfsi.o _floatsidf.o _floatsisf.o _truncdfsf2.o \
	_extendsfdf2.o _addsf3.o _negsf2.o _subsf3.o _mulsf3.o _divsf3.o \
	_eqdf2.o _nedf2.o _gtdf2.o _gedf2.o _ltdf2.o _ledf2.o \
	_eqsf2.o _nesf2.o _gtsf2.o _gesf2.o _ltsf2.o _lesf2.o

SHAREDLIBGCC2OBJS= _divdi3.o _moddi3.o _negdi2.o \
	_lshrdi3.o _lshldi3.o _ashldi3.o _ashrdi3.o _ffsdi2.o _udiv_w_sdiv.o \
	_cmpdi2.o _ucmpdi2.o _floatdidf.o _floatdisf.o \
	_fixunsdfsi.o _fixunssfsi.o _fixunsdfdi.o _fixdfdi.o _fixunssfdi.o \
	_fixsfdi.o _fixxfdi.o _fixunsxfdi.o _floatdixf.o _fixunsxfsi.o \
	__gcc_bcmp.o _varargs.o \
	_bb.o _shtab.o _clear_cache.o _trampoline.o __main.o _exit.o _ctors.o

HAVE_SHAREDLIBGCC=true
HAVE_SHAREDLIBGCC=false

HAVE_SHAREDLIBC=true

JUMP_LIB=libc
JUMP_DIR:=./jump/$(SHLIB)

ifeq "$(LIBYP)" "libc"

STUBNAMES=libc libcurses libtermcap libdbm # libgcc

else

STUBNAMES=libc libcurses libtermcap libdbm $(LIBYP) # libgcc

endif

endif		# not math library.

STUBLIBS:= $(shell for l in $(STUBNAMES); do echo $$l.sa;done)

ifndef FIRST_PASS

JUMP_PARAMS=$(JUMP_DIR)/jump.params.build
SHLIB_NAME:= $(shell awk -F= ' { if ($$1 == "Name")  print $$2 }' $(JUMP_PARAMS))
SHLIB_TEXT:= $(shell awk -F= ' { if ($$1 == "Text")  print $$2 }' $(JUMP_PARAMS))
SHLIB_DATA:= $(shell awk -F= ' { if ($$1 == "Data")  print $$2 }' $(JUMP_PARAMS))
SHLIB_JUMP:= $(shell awk -F= ' { if ($$1 == "Jump")  print $$2 }' $(JUMP_PARAMS))
SHLIB_GOT:= $(shell awk -F= ' { if ($$1 == "GOT")  print $$2 }' $(JUMP_PARAMS))
SHLIB_VERSION:= $(shell awk -F= ' { if ($$1 == "Version")  print $$2 }' $(JUMP_PARAMS))

SHLIB_VERSION_MAJOR:=$(shell awk -F= ' { \
  if ($$1 == "Version") { \
    for (i = 1; i <= length ($$2); i++) { \
      if (substr ($$2, i, 1) == ".") { \
	print substr ($$2, 1, i - 1); break; \
      } } } } ' $(JUMP_PARAMS))

SHLIB_FILE:=$(shell basename $(SHLIB_NAME)).so.$(SHLIB_VERSION)

SHLIB_FILE_MAJOR:=$(shell basename $(SHLIB_NAME)).so.$(SHLIB_VERSION_MAJOR)

TARGET=shared

endif

endif

ifdef LITE

LIBS	= libc.a libtermcap.a libcompat.a libalias.a libgcc.a
LIBS	= libc.a libtermcap.a libcompat.a libalias.a libgcc3.a

# for light C library without curses, gdbm and gmon
DIRS = bsd cvt ctype dirent grp inet io libio locale login \
	malloc-930716 misc mntent posix pwd regex rpc setjmp signal \
	stdlib string sysdeps termcap time ufc compat gcc $(YPDIR)

#	jumptable1 jumptable2

TARGET=lite

endif

all: $(TARGET)

lib:
	for i in $(DIRS); do \
		echo making $$i; \
		(cd $$i; $(MAKE)); \
	done
	for l in $(LIBS); \
	do \
	  $(AR) -dv $$l  __.SYMDEF; \
	  $(REALRANLIB) -v $$l; \
	done

dep:
	for i in $(DIRS); do \
		echo making depend $$i; \
		(cd $$i; $(MAKE) dep); \
	done

clean:
	$(RM) -f $(CLEANLIBS) libalias.a core *.o *.s *.sa *.so.* \
		verify.out
	for i in $(CLEANDIRS); do \
	   echo cleaning $$i; \
	   (cd $$i; $(MAKE) clean); \
	done

realclean:
	$(RM) -f $(CLEANLIBS) libalias.a core *.o *.s *.sa *.so.* \
		verify.out
	for i in $(CLEANDIRS); do \
	   echo cleaning $$i; \
	   (cd $$i; $(MAKE) realclean); \
	done

lite: lib build.lite

shared: lib build.shared

build.lite: 
	$(MKIMAGE) -l $(SHLIB_NAME) -v $(SHLIB_VERSION) -a $(SHLIB_TEXT) \
		-d $(SHLIB_DATA) -j $(SHLIB_JUMP)  -g $(SHLIB_GOT) \
		-- $(LIBS)
	mv $(SHLIB_FILE) lib.so # do this trick for stupid fs
	$(STRIP) lib.so
	mv lib.so $(SHLIB_FILE)

build.shared:
	$(RM) -f $(STUBLIBS)
	$(MKIMAGE) -l $(SHLIB_NAME) -v $(SHLIB_VERSION) -a $(SHLIB_TEXT) \
		-d $(SHLIB_DATA) -j $(SHLIB_JUMP)  -g $(SHLIB_GOT) \
		-- $(LIBS) $(SYSLIBS)
	$(MKSTUBS) -l $(SHLIB_NAME) -v $(SHLIB_VERSION) -a $(SHLIB_TEXT) \
		-d $(SHLIB_DATA) -j $(SHLIB_JUMP)  -g $(SHLIB_GOT) \
		-- $(STUBNAMES)
	$(VERIFY) -l $(SHLIB_FILE) $(STUBLIBS)
	mv $(SHLIB_FILE) lib.so # do this trick for stupid fs
	$(STRIP) lib.so
	mv lib.so $(SHLIB_FILE)
	if [ x"$(HAVE_SHAREDLIBGCC)"x = xtruex -o \
		x"$(HAVE_SHAREDLIBC)"x = xtruex ]; then \
	  if [ -d tmpcopy ]; then $(RM) -f ./tmpcopy/*; \
	  else mkdir tmpcopy; fi; \
	else true; fi
	if [ x"$(HAVE_SHAREDLIBGCC)"x = xtruex ]; then \
	  (cd ./tmpcopy; \
	   $(AR) -x $(TARGET_LIB_DIR)/libgcc.a $(SHAREDLIBGCC1OBJS)); \
	else true; fi
	if [ x"$(HAVE_SHAREDLIBGCC)"x = xtruex ]; then \
	  (cd ./tmpcopy; \
	   $(AR) -x $(TARGET_LIB_DIR)/libgcc.a $(SHAREDLIBGCC2OBJS)); \
	else true; fi
	if [ x"$(HAVE_SHAREDLIBGCC)"x = xtruex ]; then \
	  (cd ./tmpcopy; \
	   $(AR) ucv ../libgcc.sa $(SHAREDLIBGCC1OBJS)); \
	else true; fi
	if [ x"$(HAVE_SHAREDLIBGCC)"x = xtruex ]; then \
	  (cd ./tmpcopy; \
	   $(AR) ucv ../libgcc.sa $(SHAREDLIBGCC2OBJS)); \
	else true; fi
	if [ x"$(HAVE_SHAREDLIBC)"x = xtruex ]; then \
	  $(RM) -fr tmpcopy/*.o; \
	  (cd ./tmpcopy; $(AR) -x ../libalias.a); \
	  (cd ./compat; $(MAKE) __old_libc.o; \
	   mv __old_libc.o ../tmpcopy); \
	  (cd ./tmpcopy; \
	   $(AR) -x ../libc.a __load.o __setfpucw.o __fpu_control.o); \
	  (cd ./tmpcopy; $(AR) ucv ../libc.sa *.o); \
	  $(RM) -fr tmpcopy; \
	else true; fi
	if [ x"$(LIBMALIAS)"x != xx ]; then \
	  if [ -d tmpcopy ]; then $(RM) -f ./tmpcopy/*; \
	  else mkdir tmpcopy; fi; \
	  (cd ./compat; $(MAKE) __old_libm.o; \
	   mv __old_libm.o ../tmpcopy); \
	  (cd ./tmpcopy; $(AR) -x ../libmalias.a); \
	  (cd ./tmpcopy; $(AR) ucv ../libm.sa *.o); \
	  $(RM) -fr tmpcopy; \
	else true; fi
	for l in $(STUBLIBS); do \
	  $(AR) -dv $$l __.SYMDEF; \
	  $(REALRANLIB) -v $$l; \
	done

install:
	@@echo which version? debug, static, or profiling.

# install static library
install.static:
	(cd crt ; $(MAKE) install)
	if [ ! -d $(TARGET_LIB_DIR) ]; then \
	  $(MKDIR) $(TARGET_LIB_DIR); \
	else true; fi
	cp $(LIBS) $(TARGET_LIB_DIR)

# install shared library
install.shared:
	$(MAKE) install.so SHARED=true

# install debug library
install.debug: libg.a
	if [ ! -d $(TARGET_LIBEXTRA_DIR) ]; then \
	  $(MKDIR) $(TARGET_LIBEXTRA_DIR); \
	else true; fi
	cp libg.a libmcheck.a $(TARGET_LIBEXTRA_DIR)

# install profiling library
install.profile: libc_p.a libgmon.a
	(cd crt ; $(MAKE) PROFILE=true install)
	if [ ! -d $(TARGET_LIBEXTRA_DIR) ]; then \
	  $(MKDIR) $(TARGET_LIBEXTRA_DIR); \
	else true; fi
	cp libc_p.a libgmon.a $(TARGET_LIBEXTRA_DIR)

# install checker library
install.checker: $(LIBS)
	if [ ! -d $(TARGET_LIBEXTRA_DIR) ]; then \
	  $(MKDIR) $(TARGET_LIBEXTRA_DIR); \
	else true; fi
	cd crt; $(MAKE) install
	for l in $(LIBS); \
	do \
	  name=$(TARGET_LIBEXTRA_DIR)/`basename $$l .a`.chkra ; \
	  cp $$l $$name ; \
	done

ifeq "$(HOST_MACHINE)" "linux"

install.so:
	if [ ! -d $(TARGET_LIB_DIR) ]; then \
	  $(MKDIR) $(TARGET_LIB_DIR); \
	else true; fi
	cp $(STUBLIBS) $(TARGET_LIB_DIR)
	if [ ! -d $(TARGET_SO_DIR) ]; then \
	  $(MKDIR) $(TARGET_SO_DIR); \
	else true; fi
	if [ -f $(TARGET_SO_DIR)/$(SHLIB_FILE) ]; then \
	  (cd $(TARGET_SO_DIR); \
	   cp $(SHLIB_FILE) /tmp; \
	   if [ $$? -eq 0 ]; then \
	     ln -sf /tmp/$(SHLIB_FILE) $(SHLIB_FILE_MAJOR); \
	   else exit 1; fi; \
	   mv $(SHLIB_FILE) $(SHLIB_FILE_MAJOR).old); \
	else true; fi
	cp $(SHLIB_FILE) $(TARGET_SO_DIR)
	(cd $(TARGET_SO_DIR); \
	   ln -sf $(SHLIB_FILE) $(SHLIB_FILE_MAJOR))

else

install.so:
	if [ ! -d $(TARGET_LIB_DIR) ]; then \
	  $(MKDIR) $(TARGET_LIB_DIR); \
	else true; fi
	cp $(STUBLIBS) $(TARGET_LIB_DIR)
	if [ ! -d $(TARGET_SO_DIR) ]; then \
	  $(MKDIR) $(TARGET_SO_DIR); \
	else true; fi
	cp $(SHLIB_FILE) $(TARGET_SO_DIR)

endif
@


1.1.1.1
log
@LIBC_4_5_7
@
text
@@


1.1.1.2
log
@LIBC_4_5_10
@
text
@d7 9
a15 1
CLEAN_DIRS= bsd cvt ctype curses dirent gdbm gmon grp inet io \
d18 6
a23 1
	compat gcc libbsd malloc-930716 yp $(NLSDIR) sbin jump
d25 1
a25 2
ifeq ($(LITE),true)
# for light C library without curses, gdbm and gmon
d27 90
a116 2
	malloc-930716 misc mntent posix pwd regex rpc setjmp signal \
	stdlib string sysdeps termcap time ufc compat gcc # yp
d118 11
a128 2
DIRS= bsd cvt ctype curses dirent gdbm gmon grp inet io \
	libio locale login malloc math misc mntent posix pwd regex \
d130 62
a191 1
	compat gcc libbsd malloc-930716 yp $(NLSDIR)
d194 16
a209 2
ifeq ($(SHARED),true)
DIRS:= $(DIRS) jump
d212 14
a225 1
lib depend:
d227 18
a244 2
		echo making $@@ in $$i; \
		(cd $$i; $(MAKE) $@@); \
d247 67
a313 8
clean realclean:
	$(RM) -f core *.o *.s *.sa *.so.* *.a verify.out
	-for d in $(OBJS_DIRS); do \
	  $(RM) -rf $$d/*; \
	done;
	for i in $(CLEAN_DIRS); do \
	   echo making $@@ in $$i; \
	   (cd $$i; $(MAKE) $@@); \
d316 2
a317 1
install: install.shared install.static install.debug install.profile
d319 7
a325 2
install.lite:
	(cd jump; $(MAKE) install LITE=true)
d327 1
d329 30
a358 1
	(cd jump; $(MAKE) install)
d360 33
a392 23
install.static:
	(cd static; $(RM) -rf tmpcopy; $(MKDIR) tmpcopy; \
	 cd tmpcopy; \
	 $(AR) -x ../../libalias.a; \
	 $(AR) ucv ../libc.a *.o; \
	 cd ..; $(RM) -rf tmpcopy; \
	 $(REALRANLIB) *.a; cp *.a crt0.o $(TARGET_LIB_DIR))

install.debug:
	(cd debug; $(RM) -rf tmpcopy; $(MKDIR) tmpcopy; \
	 cd tmpcopy; \
	 $(AR) -x ../../libalias.a; \
	 $(AR) ucv ../libg.a *.o; \
	 cd ..; $(RM) -rf tmpcopy; \
	 $(REALRANLIB) *.a; cp *.a $(TARGET_LIBEXTRA_DIR))

install.profile:
	(cd profile; $(RM) -rf tmpcopy; $(MKDIR) tmpcopy; \
	 cd tmpcopy; \
	 $(AR) -x ../../libalias.a; \
	 $(AR) ucv ../libc_p.a *.o; \
	 cd ..; $(RM) -rf tmpcopy; \
	 $(REALRANLIB) *.a; cp *.a gcrt0.o $(TARGET_LIBEXTRA_DIR))
@


1.1.1.3
log
@LIBC_4_5_11
@
text
@d5 1
a5 1
TOPDIR=.
a6 2
include $(TOPDIR)/Makeconfig

d36 3
a38 1
	$(RM) -rf $(OBJS_DIRS)
@
