Swap sed and make.

This allows to use makefile rather than kaem script for building sed.
Makefiles for musl and mes are unified into one makefile with some
conditional code.
This commit is contained in:
Andrius Štikonas 2022-05-13 22:46:56 +01:00
parent 3ed5daa5aa
commit b9079045db
8 changed files with 37 additions and 50 deletions

View file

@ -12,11 +12,19 @@ CPPFLAGS = -DENABLE_NLS=0 \
-DSED_FEATURE_VERSION=\"4.0\" \
-DVERSION=\"4.0.9\" \
-DPACKAGE=\"sed\"
CFLAGS = -I . -I lib
CFLAGS = -I . -I lib -static
LDFLAGS = -L. -lsed
.PHONY: all
LIB_SRC = alloca getopt1 getopt utils regex obstack strverscmp mkstemp
ifeq ($(LIBC),mes)
LIB_SRC = getline
else
LIB_SRC = alloca
endif
LIB_SRC += getopt1 getopt utils regex obstack strverscmp mkstemp
LIB_OBJ = $(addprefix lib/, $(addsuffix .o, $(LIB_SRC)))
SED_SRC = compile execute regexp fmt sed
@ -24,11 +32,16 @@ SED_OBJ = $(addprefix sed/, $(addsuffix .o, $(SED_SRC)))
all: sed/sed
lib/regex.h: lib/regex_.h
cp $< $@
lib/regex.o: lib/regex.h
libsed.a: $(LIB_OBJ)
$(AR) cr $@ $^
sed/sed: $(SED_OBJ) libsed.a
$(CC) -o $@ $^
sed/sed: libsed.a $(SED_OBJ)
$(CC) $^ $(LDFLAGS) -o $@
install:
install -D sed/sed $(DESTDIR)$(PREFIX)/bin/sed