2004-11-22 16:47:29 +03:00
PACKAGE = propagator
2004-01-20 21:32:43 +03:00
2004-11-22 16:47:29 +03:00
DESTDIR =
2004-12-06 22:55:19 +03:00
2008-03-16 02:25:40 +03:00
bindir = /usr/bin
libdir = /usr/lib
2004-12-07 19:08:11 +03:00
2008-03-16 02:25:40 +03:00
INSTALL = /bin/install
2005-07-08 03:45:12 +04: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 17:33:39 +04:00
2008-03-01 22:02:06 +03:00
GLIBC_INCLUDES =
KLIBC_INCLUDES =
INCLUDES = $( $( L) _INCLUDES)
2008-03-12 15:19:18 +03:00
GLIBC_LDFLAGS = -static
KLIBC_LDFLAGS =
LDFLAGS = $( $( L) _LDFLAGS)
2008-03-01 22:02:06 +03:00
STRIPCMD = strip -R .note -R .comment
2008-03-12 15:19:18 +03:00
2008-03-01 22:02:06 +03:00
#---------------------------------------------------------------
DEFS = -D_GNU_SOURCE
2006-11-24 17:58:05 +03:00
2008-03-12 15:19:18 +03:00
#---------------------------------------------------------------
INITSRC = init.c
INITOBJS = $( addprefix $( L) -,$( subst .c,.o,$( INITSRC) ) )
#---------------------------------------------------------------
STAGE1_DEFS =
2004-12-06 22:55:19 +03:00
i f n e q ( $( WITH_SHELL ) , )
2006-11-24 17:58:05 +03:00
STAGE1_DEFS += -DSPAWN_SHELL
2004-12-06 22:55:19 +03: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 22:26:48 +03: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 22:26:48 +03:00
e n d i f
2004-12-06 22:55:19 +03:00
2008-03-01 22:02:06 +03:00
COMPILE = $( CC) $( CFLAGS) $( DEFS)
2004-01-20 21:32:43 +03:00
2004-11-22 16:47:29 +03:00
#- frontends
2004-01-20 21:32:43 +03:00
NEWT_FRONTEND_SRC = newt-frontend.c
2008-03-16 02:25:40 +03:00
NEWT_FRONTEND_LIBS = $( libdir) /libnewt.a $( libdir) /libslang.a
2004-01-20 21:32:43 +03:00
STDIO_FRONTEND_SRC = stdio-frontend.c
2008-03-01 22:02:06 +03:00
STDIO_FRONTEND_LIBS =
2004-01-20 21:32:43 +03: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 21:32:43 +03:00
2008-03-01 22:02:06 +03:00
GLIBC_STAGE1_OWN_LIBS =
KLIBC_STAGE1_OWN_LIBS =
2004-01-20 21:32:43 +03:00
STAGE1_OWN_LIBS = $( $( L) _STAGE1_OWN_LIBS)
2008-03-12 15:19:18 +03:00
KLIBC_STAGE1_NETWORK_LIBS =
2008-03-16 02:25:40 +03:00
GLIBC_STAGE1_NETWORK_LIBS = $( libdir) /libresolv.a
2008-03-12 15:19:18 +03:00
STAGE1_NETWORK_LIBS = $( $( L) _STAGE1_NETWORK_LIBS)
2004-01-20 21:32:43 +03:00
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 \
2008-03-13 19:12:12 +03:00
network.c dhcp.c url.c dns.c adsl.c
2008-03-01 22:02:06 +03:00
STAGE1OBJS = $( addprefix $( L) -,$( subst .c,.o,$( STAGE1SRC) ) )
2004-01-20 21:32:43 +03:00
2008-03-12 15:19:18 +03:00
#---------------------------------------------------------------
ALLSRC = $( INITSRC) $( STAGE1SRC)
TARGETS = init gencpio
2004-01-20 21:32:43 +03:00
2008-03-12 15:19:18 +03:00
all : version .h $( TARGETS )
2004-01-20 21:32:43 +03:00
2008-03-12 15:19:18 +03:00
init : $( INITOBJS ) $( STAGE 1OBJS ) $( STAGE 1_OWN_LIBS ) $( STAGE 1_NETWORK_LIBS ) $( FRONTEND_LINK ) $( STAGE 1_LIBC )
$( CC) -o $@ $^ $( LDFLAGS)
2004-01-20 21:32:43 +03:00
$( STRIPCMD) $@
2008-03-01 22:02:06 +03:00
$(INITOBJS) : $( L ) -%.o : %.c
$( COMPILE) $( INIT_DEFS) -c $< -o $@
2004-01-20 21:32:43 +03: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 22:47:24 +04:00
2008-03-01 22:02:06 +03:00
$(FRONTEND_OBJS) : $( L ) -%.o : %.c
$( COMPILE) $( INCLUDES) -c $< -o $@
2004-01-20 21:32:43 +03:00
2004-11-22 16:47:29 +03: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 21:32:43 +03:00
2008-03-01 22:02:06 +03:00
gencpio : gen_init_cpio .c
$( CC) $( CFLAGS) $( DEFS) -o $@ $^
initfs : mkinitfs $( TARGETS )
sh $< $@
install : initfs
2008-03-16 02:25:40 +03:00
$( INSTALL) -D -m0755 gencpio $( DESTDIR) $( bindir) /gencpio
$( INSTALL) -m0755 mkmodpack $( DESTDIR) $( bindir) /mkmodpack
$( INSTALL) -D -m0644 initfs $( DESTDIR) $( libdir) /$( PACKAGE) /initfs
2008-03-01 22:02:06 +03:00
2004-01-20 21:32:43 +03:00
clean :
2006-11-24 17:58:05 +03:00
rm -f *.o .depend $( TARGETS) version.h
2004-01-20 21:32:43 +03:00
2008-03-12 15:19:18 +03:00
.depend : version .h
2004-01-20 21:32:43 +03:00
$( 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