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 =
2013-08-22 20:48:09 +04:00
MUSL_LDFLAGS = -static
2013-08-22 20:49:07 +04:00
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
#---------------------------------------------------------------
2019-04-18 12:00:06 +03:00
DEFS = -D_GNU_SOURCE -D_FILE_OFFSET_BITS= 64
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 =
2014-01-11 18:49:44 +04:00
i f n e q ( $( WITH_CIFS ) , )
STAGE1_DEFS += -DENABLE_CIFS
e n d i f
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 \
2018-04-22 17:43:47 +03:00
cdrom.c disk.c common.c udev.c \
2014-04-19 10:50:25 +04:00
network.c dhcp.c url.c dns.c adsl.c \
sha256.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
2009-07-29 18:12:01 +04:00
version.h :
2009-07-29 18:52:02 +04:00
echo -e \# define VERSION \" $( version) \" \\ n\# define DISTRIB_NAME \" ALT Linux\" > $@
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 $@ $^
2012-11-09 14:17:14 +04:00
install :
2008-03-16 02:25:40 +03:00
$( INSTALL) -D -m0755 gencpio $( DESTDIR) $( bindir) /gencpio
$( INSTALL) -m0755 mkmodpack $( DESTDIR) $( bindir) /mkmodpack
2010-11-30 22:15:52 +03:00
$( INSTALL) -D -m0755 init $( DESTDIR) /usr/sbin/propagator
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