propagator/Makefile
Alexey Sheplyakov 736c89620f http_download_file: fixed download of files >= 2GB size
* Use `unsigned long` to store the file size
* Return an error if the file size can not be found
* Avoid loading files >= 4GB on 32-bit systems

Related: #40710
2021-09-17 17:26:33 +04:00

141 lines
3.1 KiB
Makefile

PACKAGE = propagator
DESTDIR =
bindir = /usr/bin
libdir = /usr/lib
INSTALL = /bin/install
#---------------------------------------------------------------
L ?= GLIBC
#L = KLIBC
ifeq ($(L),KLIBC)
CC = klcc
endif
ifeq ($(F),)
ifeq ($(L),GLIBC)
F = NEWT
else
F = STDIO
endif
endif
CFLAGS += -Os -pipe -Wall
GLIBC_INCLUDES =
KLIBC_INCLUDES =
INCLUDES = $($(L)_INCLUDES)
GLIBC_LDFLAGS = -static
KLIBC_LDFLAGS =
MUSL_LDFLAGS = -static
LDFLAGS += $($(L)_LDFLAGS)
STRIPCMD = strip -R .note -R .comment
#---------------------------------------------------------------
DEFS = -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
#---------------------------------------------------------------
INITSRC = init.c
INITOBJS = $(addprefix $(L)-,$(subst .c,.o,$(INITSRC)))
#---------------------------------------------------------------
STAGE1_DEFS =
ifneq ($(WITH_CIFS),)
STAGE1_DEFS += -DENABLE_CIFS
endif
ifneq ($(WITH_SHELL),)
STAGE1_DEFS += -DSPAWN_SHELL
endif
ifneq ($(WITH_SPLASH),)
STAGE1_DEFS += -DSPAWN_SPLASH
endif
ifeq ($(WITH_ADSL),)
STAGE1_DEFS += -DDISABLE_ADSL
endif
ifneq ($(WITHOUT_USBNET),)
STAGE1_DEFS += -DDISABLE_USBNET
endif
COMPILE = $(CC) $(CFLAGS) $(DEFS)
#- frontends
NEWT_FRONTEND_SRC = newt-frontend.c
NEWT_FRONTEND_LIBS = $(libdir)/libnewt.a $(libdir)/libslang.a
STDIO_FRONTEND_SRC = stdio-frontend.c
STDIO_FRONTEND_LIBS =
FRONTEND_OBJS = $(addprefix $(L)-,$(subst .c,.o,$($(F)_FRONTEND_SRC)))
FRONTEND_LINK = $(FRONTEND_OBJS) $($(F)_FRONTEND_LIBS)
GLIBC_STAGE1_OWN_LIBS =
KLIBC_STAGE1_OWN_LIBS =
STAGE1_OWN_LIBS = $($(L)_STAGE1_OWN_LIBS)
KLIBC_STAGE1_NETWORK_LIBS =
GLIBC_STAGE1_NETWORK_LIBS = $(libdir)/libresolv.a
STAGE1_NETWORK_LIBS = $($(L)_STAGE1_NETWORK_LIBS)
STAGE1SRC = stage1.c log.c tools.c modules.c probing.c \
mount.c lomount.c automatic.c frontend-common.c \
cdrom.c disk.c common.c udev.c \
network.c dhcp.c url.c dns.c adsl.c \
sha256.c
STAGE1OBJS = $(addprefix $(L)-,$(subst .c,.o,$(STAGE1SRC)))
#---------------------------------------------------------------
ALLSRC = $(INITSRC) $(STAGE1SRC)
TARGETS = init gencpio
all: version.h $(TARGETS)
init: $(INITOBJS) $(STAGE1OBJS) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
$(CC) -o $@ $^ $(LDFLAGS)
$(STRIPCMD) $@
$(INITOBJS): $(L)-%.o: %.c
$(COMPILE) $(INIT_DEFS) -c $< -o $@
$(STAGE1OBJS): $(L)-%.o: %.c
$(COMPILE) $(INCLUDES) $(STAGE1_DEFS) -c $< -o $@
$(FRONTEND_OBJS): $(L)-%.o: %.c
$(COMPILE) $(INCLUDES) -c $< -o $@
version.h:
echo -e \#define VERSION \"$(version)\" \\n\#define DISTRIB_NAME \"ALT Linux\" > $@
gencpio: gen_init_cpio.c
$(CC) $(CFLAGS) $(DEFS) -o $@ $^
install:
$(INSTALL) -D -m0755 gencpio $(DESTDIR)$(bindir)/gencpio
$(INSTALL) -m0755 mkmodpack $(DESTDIR)$(bindir)/mkmodpack
$(INSTALL) -D -m0755 init $(DESTDIR)/usr/sbin/propagator
clean:
rm -f *.o .depend $(TARGETS) version.h
.depend: version.h
$(CPP) $(CFLAGS) -M $(ALLSRC) > .depend
ALL_TESTS := test_parse_content_length
test: $(ALL_TESTS)
@set -e; \
for tst in $(ALL_TESTS); do echo "$$tst"; ./$$tst; done
test_parse_content_length: test_parse_content_length.c url.c
$(CC) $(CFLAGS) -flto $(INIT_DEFS) -o $@ $<
ifeq (.depend,$(wildcard .depend))
include .depend
endif