2004-11-22 13:47:29 +00:00
PACKAGE = propagator
2004-01-20 18:32:43 +00:00
2004-11-22 13:47:29 +00:00
DESTDIR =
2004-12-06 19:55:19 +00:00
2004-12-17 23:38:21 +00:00
BINDIR ?= /usr/bin
2005-07-07 23:45:12 +00:00
LIBDIR ?= /usr/lib
2006-11-24 17:58:05 +03:00
BINSDIR ?= $( LIBDIR) /$( PACKAGE) /bin
2004-12-07 16:08:11 +00:00
2008-03-01 22:02:06 +03:00
INSTALL = /usr/bin/install
2006-11-24 17:58:05 +03:00
TARGETS = init stage1 gencpio
2004-01-20 18:32:43 +00:00
2006-11-24 17:58:05 +03:00
all : version .h $( TARGETS )
2005-07-07 23:45:12 +00:00
2008-03-01 22:02:06 +03:00
#---------------------------------------------------------------
L ?= GLIBC
#L = KLIBC
i f e q ( $( L ) , K L I B C )
CC = klcc
e n d i f
i f e q ( $( F ) , )
i f e q ( $( L ) , G L I B C )
F = NEWT
e l s e
F = STDIO
e n d i f
e n d i f
CFLAGS += -Os -pipe -Wall
2005-08-05 13:33:39 +00:00
2008-03-01 22:02:06 +03:00
GLIBC_INCLUDES =
KLIBC_INCLUDES =
INCLUDES = $( $( L) _INCLUDES)
GCC_LIBDIR = $( shell dirname ` gcc -print-libgcc-file-name` )
LIBGCC_A = $( shell gcc -print-libgcc-file-name)
GLIBC_LDFLAGS_STAGE1 = -static
KLIBC_LDFLAGS_STAGE1 =
# $(LIBGCC_A)
LDFLAGS_STAGE1 = $( $( L) _LDFLAGS_STAGE1)
GLIBC_LIBC =
KLIBC_LIBC =
STAGE1_LIBC = $( $( L) _LIBC)
STRIPCMD = strip -R .note -R .comment
#---------------------------------------------------------------
DEFS = -D_GNU_SOURCE
2006-11-24 17:58:05 +03:00
INIT_DEFS =
STAGE1_DEFS =
2004-12-06 19:55:19 +00:00
i f n e q ( $( WITH_SHELL ) , )
2006-11-24 17:58:05 +03:00
STAGE1_DEFS += -DSPAWN_SHELL
2004-12-06 19:55:19 +00:00
e n d i f
2007-05-25 16:37:51 +04:00
i f n e q ( $( WITH_SPLASH ) , )
STAGE1_DEFS += -DSPAWN_SPLASH
e n d i f
2005-02-28 19:26:48 +00:00
i f e q ( $( WITH_ADSL ) , )
2006-11-24 17:58:05 +03:00
STAGE1_DEFS += -DDISABLE_ADSL
e n d i f
i f n e q ( $( WITHOUT_USBNET ) , )
STAGE1_DEFS += -DDISABLE_USBNET
2005-02-28 19:26:48 +00:00
e n d i f
2004-12-06 19:55:19 +00:00
2008-03-01 22:02:06 +03:00
COMPILE = $( CC) $( CFLAGS) $( DEFS)
2004-01-20 18:32:43 +00:00
2004-11-22 13:47:29 +00:00
#- stage1 "loader"
# i386 name is invalid to force this feature off
2004-01-20 18:32:43 +00:00
INITSRC = init.c
2008-03-01 22:02:06 +03:00
INIT_DEFS = $( INCLUDES)
2004-01-20 18:32:43 +00:00
2008-03-01 22:02:06 +03:00
INITOBJS = $( addprefix $( L) -,$( subst .c,.o,$( INITSRC) ) )
2004-01-20 18:32:43 +00:00
2004-11-22 13:47:29 +00:00
#- frontends
2004-01-20 18:32:43 +00:00
NEWT_FRONTEND_SRC = newt-frontend.c
2008-03-01 22:02:06 +03:00
NEWT_FRONTEND_LIBS = $( LIBDIR) /libnewt.a $( LIBDIR) /libslang.a
2004-01-20 18:32:43 +00:00
STDIO_FRONTEND_SRC = stdio-frontend.c
2008-03-01 22:02:06 +03:00
STDIO_FRONTEND_LIBS =
2004-01-20 18:32:43 +00:00
2008-03-01 22:02:06 +03:00
FRONTEND_OBJS = $( addprefix $( L) -,$( subst .c,.o,$( $( F) _FRONTEND_SRC) ) )
FRONTEND_LINK = $( FRONTEND_OBJS) $( $( F) _FRONTEND_LIBS)
2004-01-20 18:32:43 +00:00
2008-03-01 22:02:06 +03:00
GLIBC_STAGE1_OWN_LIBS =
KLIBC_STAGE1_OWN_LIBS =
2004-01-20 18:32:43 +00:00
STAGE1_OWN_LIBS = $( $( L) _STAGE1_OWN_LIBS)
2008-03-01 22:02:06 +03:00
i f e q ( $( L ) , K L I B C )
STAGE1_NETWORK_LIBS =
2004-01-20 18:32:43 +00:00
e n d i f
2008-03-01 22:02:06 +03:00
i f e q ( $( L ) , G L I B C )
2007-03-16 15:08:50 +03:00
STAGE1_NETWORK_LIBS = $( LIBDIR) /libresolv.a
2004-01-20 18:32:43 +00:00
e n d i f
2004-11-22 13:47:29 +00:00
###############################################################################
# stage1 itself
2006-11-24 17:58:05 +03:00
STAGE1SRC = stage1.c log.c tools.c modules.c probing.c \
mount.c lomount.c automatic.c frontend-common.c \
cdrom.c disk.c \
network.c nfsmount.c dhcp.c url.c dns.c adsl.c
2008-03-01 22:02:06 +03:00
2006-11-24 17:58:05 +03:00
ALLSRC = $( INITSRC) $( STAGE1SRC)
2004-11-22 13:47:29 +00:00
###############################################################################
2004-01-20 18:32:43 +00:00
2008-03-01 22:02:06 +03:00
STAGE1OBJS = $( addprefix $( L) -,$( subst .c,.o,$( STAGE1SRC) ) )
2004-01-20 18:32:43 +00:00
2008-03-01 22:02:06 +03:00
LDFLAGS_INIT = $( $( L) _LDFLAGS_STAGE1)
INIT_LIBC = $( $( L) _LIBC)
2004-01-20 18:32:43 +00:00
2008-03-01 22:02:06 +03:00
init : $( INITOBJS ) $( INIT_LIBC )
2004-01-20 18:32:43 +00:00
$( CC) -o $@ $^ $( LDFLAGS_INIT)
$( STRIPCMD) $@
2006-11-24 17:58:05 +03:00
stage1 : $( STAGE 1OBJS ) $( STAGE 1_OWN_LIBS ) $( STAGE 1_NETWORK_LIBS ) $( FRONTEND_LINK ) $( STAGE 1_LIBC )
2004-01-20 18:32:43 +00:00
$( CC) -o $@ $^ $( LDFLAGS_STAGE1)
$( STRIPCMD) $@
2008-03-01 22:02:06 +03:00
$(INITOBJS) : $( L ) -%.o : %.c
$( COMPILE) $( INIT_DEFS) -c $< -o $@
2004-01-20 18:32:43 +00:00
2008-03-01 22:02:06 +03:00
$(STAGE1OBJS) : $( L ) -%.o : %.c
2006-11-24 17:58:05 +03:00
$( COMPILE) $( INCLUDES) $( STAGE1_DEFS) -c $< -o $@
2004-04-14 18:47:24 +00:00
2008-03-01 22:02:06 +03:00
$(FRONTEND_OBJS) : $( L ) -%.o : %.c
$( COMPILE) $( INCLUDES) -c $< -o $@
2004-01-20 18:32:43 +00:00
2004-11-22 13:47:29 +00:00
version.h : /etc /altlinux -release
@sed ' s| ^ALT Linux \( [ ^ ] \+ \) \( [ ^( ] \+ \) ( \( [ ^) ] \+ \) ) | \
echo \\ #define VERSION \\"\2\\";echo \\#define DISTRIB_NAME \\"ALT Linux\2\1 \\(\3\\)\\"|' < $^ |sh > $@
2004-01-20 18:32:43 +00:00
2008-03-01 22:02:06 +03:00
gencpio : gen_init_cpio .c
$( CC) $( CFLAGS) $( DEFS) -o $@ $^
initfs : mkinitfs $( TARGETS )
sh $< $@
install : initfs
$( INSTALL) -D -m0755 gencpio $( DESTDIR) $( BINDIR) /gencpio
2008-03-07 19:03:47 +03:00
$( INSTALL) -m0755 mkmodpack $( DESTDIR) $( BINDIR) /mkmodpack
2008-03-01 22:02:06 +03:00
$( INSTALL) -D -m0644 initfs $( DESTDIR) $( LIBDIR) /$( PACKAGE) /initfs
2004-01-20 18:32:43 +00:00
clean :
2006-11-24 17:58:05 +03:00
rm -f *.o .depend $( TARGETS) version.h
2004-01-20 18:32:43 +00:00
.depend :
$( CPP) $( CFLAGS) -M $( ALLSRC) > .depend
i f e q ( . d e p e n d , $( wildcard .depend ) )
i n c l u d e . d e p e n d
e n d i f