Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
834dd388
Commit
834dd388
authored
Jun 03, 2014
by
Alejandro Mery
Browse files
lib: recursive makefiles considered harmful (tm)
Signed-off-by:
Alejandro Mery
<
amery@geeks.cl
>
parent
6edc1502
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/Makefile
0 → 100644
View file @
834dd388
.PHONY
:
all libs
CC
=
gcc
AR
=
ar
srctree
?=
..
O
?=
$(srctree)
/out
OBJDIR
:=
$(O)
/lib
DEPS
:=
$(OBJDIR)
/deps.mk
INCLUDES
=
-I
$(srctree)
/include
CFLAGS
=
-O2
CFLAGS
+=
-Wall
-Wextra
-std
=
c99
-D_POSIX_C_SOURCE
=
200112L
CFLAGS
+=
$(INCLUDES)
SRCS
:=
all
:
libs
include
libfex/Makefile
# *.a
%.a
:
@
mkdir
-vp
$
(
@D
)
$(AR)
rcs
$@
$^
# *.o
%.o
:
SRC=$(patsubst $(OBJDIR)/%.o
,
%.c
,
$@)
%.o
:
@
mkdir
-vp
$
(
@D
)
$(CC)
$(CFLAGS)
-c
-o
$@
$(SRC)
# dependencies
$(DEPS)
:
Makefile libfex/Makefile
mkdir
-p
$
(
@D
)
for
x
in
$(SRCS)
;
do
\
$(CC)
-MM
-MT
$(OBJDIR)
/
$
${x%.c}
.o
$$
x
$(INCLUDES)
;
\
done
>
$@
~
mv
$@
~
$@
include
$(DEPS)
lib/libfex/Makefile
View file @
834dd388
CC
=
gcc
AR
=
ar
libfex_SOURCES
:=
$(
wildcard
libfex/
*
.c
)
libfex_OBJS
:=
$(
patsubst
%.c,
$(OBJDIR)
/%.o,
$(libfex_SOURCES)
)
libfex_LIB
:=
$(O)
/libfex.a
srctree
?=
../..
O
?=
$(srctree)
/out
SRCS
+=
$(libfex_SOURCES)
O
BJS
+=
$(libfex_OBJS)
OBJDIR
:=
$(O)
/libfex
LIBFEX
:=
$(O)
/libfex.a
libs
:
$(libfex_LIB)
SRCS
:=
$(
wildcard
*
.c
)
OBJS
:=
$(
patsubst
%.c,
$(OBJDIR)
/%.o,
$(SRCS)
)
INCLUDES
=
-I
$(srctree)
/include
CFLAGS
=
-O2
CFLAGS
+=
-Wall
-Wextra
-std
=
c99
-D_POSIX_C_SOURCE
=
200112L
CFLAGS
+=
$(INCLUDES)
DEPS
:=
$(OBJDIR)
/deps.mk
# libfex.a
$(LIBFEX)
:
$(OBJS)
@
mkdir
-vp
$
(
@D
)
$(AR)
rcs
$@
$^
# out/foo.o: foo.c
$(OBJS)
:
SRC=$(patsubst $(OBJDIR)/%.o
,
%.c
,
$@)
$(OBJS)
:
@
mkdir
-vp
$
(
@D
)
$(CC)
$(CFLAGS)
-c
-o
$@
$(SRC)
# dependencies
$(DEPS)
:
Makefile
mkdir
-p
$
(
@D
)
for
x
in
$(SRCS)
;
do
\
$(CC)
-MM
-MT
$(OBJDIR)
/
$
${x%.c}
.o
$$
x
$(INCLUDES)
;
\
done
>
$@
~
mv
$@
~
$@
include
$(DEPS)
$(libfex_LIB)
:
$(libfex_OBJS)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment