Updated make
This commit is contained in:
parent
deef828e3c
commit
d3d24e46b4
15
Makefile
15
Makefile
@ -1,6 +1,13 @@
|
|||||||
all:
|
objects = coreutils console-tools networking miscutils
|
||||||
chmod +x build.sh
|
|
||||||
./build.sh rootfs
|
CFLAGS?=-s -Os -flto -pedantic -Wall -Wextra
|
||||||
|
CC?=cc
|
||||||
|
|
||||||
|
all: $(objects)
|
||||||
|
|
||||||
|
$(objects):
|
||||||
|
echo MAKE $@
|
||||||
|
cd $@ && $(MAKE) -B CC="$(CC)" CFLAGS="$(CFLAGS)" && cd ..
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
./build.sh clean
|
rm bin/*
|
||||||
|
25
build.sh
25
build.sh
@ -1,25 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
if [ -z $CC ]; then
|
|
||||||
CC=cc
|
|
||||||
fi
|
|
||||||
if [ -z $CFLAGS ]; then
|
|
||||||
CFLAGS="-s -Os -pedantic -Wall -Wextra"
|
|
||||||
fi
|
|
||||||
if [ -z $1 ]; then
|
|
||||||
echo $0 "[rootfs / clean]"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "ENV: CC: " $CC "| CFLAGS: " $CFLAGS
|
|
||||||
|
|
||||||
if [ $1 = "clean" ]; then
|
|
||||||
rm bin/*
|
|
||||||
elif [ $1 = "rootfs" ]; then
|
|
||||||
applets="coreutils/* miscutils/* console-tools/* networking/*"
|
|
||||||
for i in $applets; do
|
|
||||||
echo CC $i
|
|
||||||
$CC $CFLAGS $i -o $(echo bin/$(basename $i .c))
|
|
||||||
done
|
|
||||||
else
|
|
||||||
echo $0 "[rootfs / clean]"
|
|
||||||
fi
|
|
11
console-tools/Makefile
Normal file
11
console-tools/Makefile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
C_SOURCES:=$(wildcard ./*.c)
|
||||||
|
C_TARGETS:=$(patsubst ./%.c, ../bin/%, $(C_SOURCES))
|
||||||
|
TARGETS:=$(C_TARGETS)
|
||||||
|
|
||||||
|
CFLAGS?=-s -Os -flto -pedantic -Wall -Wextra
|
||||||
|
CC?=cc
|
||||||
|
|
||||||
|
all: ../bin $(TARGETS)
|
||||||
|
|
||||||
|
../bin/%: %.c
|
||||||
|
$(CC) $(CFLAGS) -o $@ $<
|
11
coreutils/Makefile
Normal file
11
coreutils/Makefile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
C_SOURCES:=$(wildcard ./*.c)
|
||||||
|
C_TARGETS:=$(patsubst ./%.c, ../bin/%, $(C_SOURCES))
|
||||||
|
TARGETS:=$(C_TARGETS)
|
||||||
|
|
||||||
|
CFLAGS?=-s -Os -flto -pedantic -Wall -Wextra
|
||||||
|
CC?=cc
|
||||||
|
|
||||||
|
all: ../bin $(TARGETS)
|
||||||
|
|
||||||
|
../bin/%: %.c
|
||||||
|
$(CC) $(CFLAGS) -o $@ $<
|
11
miscutils/Makefile
Normal file
11
miscutils/Makefile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
C_SOURCES:=$(wildcard ./*.c)
|
||||||
|
C_TARGETS:=$(patsubst ./%.c, ../bin/%, $(C_SOURCES))
|
||||||
|
TARGETS:=$(C_TARGETS)
|
||||||
|
|
||||||
|
CFLAGS?=-s -Os -flto -pedantic -Wall -Wextra
|
||||||
|
CC?=cc
|
||||||
|
|
||||||
|
all: ../bin $(TARGETS)
|
||||||
|
|
||||||
|
../bin/%: %.c
|
||||||
|
$(CC) $(CFLAGS) -o $@ $<
|
11
networking/Makefile
Normal file
11
networking/Makefile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
C_SOURCES:=$(wildcard ./*.c)
|
||||||
|
C_TARGETS:=$(patsubst ./%.c, ../bin/%, $(C_SOURCES))
|
||||||
|
TARGETS:=$(C_TARGETS)
|
||||||
|
|
||||||
|
CFLAGS?=-s -Os -flto -pedantic -Wall -Wextra
|
||||||
|
CC?=cc
|
||||||
|
|
||||||
|
all: ../bin $(TARGETS)
|
||||||
|
|
||||||
|
../bin/%: %.c
|
||||||
|
$(CC) $(CFLAGS) -o $@ $<
|
Loading…
Reference in New Issue
Block a user