Makefile: add all rule
This commit is contained in:
parent
601995f889
commit
023c2ae85b
@ -18,7 +18,6 @@ lib = libexample.so
|
|||||||
lib_src = lib.c
|
lib_src = lib.c
|
||||||
lib_obj = $(lib_src:%.c=%.o)
|
lib_obj = $(lib_src:%.c=%.o)
|
||||||
lib_dep = $(lib_src:%.c=%.d)
|
lib_dep = $(lib_src:%.c=%.d)
|
||||||
$(info $$lib_obj is ${lib_obj})
|
|
||||||
|
|
||||||
sources = $(filter-out $(lib_src), $(wildcard *.c))
|
sources = $(filter-out $(lib_src), $(wildcard *.c))
|
||||||
objects = $(sources:%.c=%.o)
|
objects = $(sources:%.c=%.o)
|
||||||
@ -29,18 +28,19 @@ cxx_sources = $(wildcard *.cpp)
|
|||||||
cxx_objects = $(cxx_sources:%.cpp=%.o)
|
cxx_objects = $(cxx_sources:%.cpp=%.o)
|
||||||
cxx_depends = $(cxx_sources:%.cpp=%.d)
|
cxx_depends = $(cxx_sources:%.cpp=%.d)
|
||||||
|
|
||||||
|
all: $(bin) $(cxxbin) $(lib)
|
||||||
|
|
||||||
$(bin): $(objects)
|
$(bin): $(objects)
|
||||||
|
|
||||||
$(cxxbin) : $(cxx_objects)
|
$(cxxbin) : $(cxx_objects)
|
||||||
|
|
||||||
|
$(lib): CFLAGS += -fpic
|
||||||
|
$(lib): $(lib_obj)
|
||||||
|
|
||||||
# C++ compilation (Use implicit LINK.CC)
|
# C++ compilation (Use implicit LINK.CC)
|
||||||
$(cxxbin):
|
$(cxxbin):
|
||||||
$(LINK.cc) $^ $(LDLIBS) -o $@
|
$(LINK.cc) $^ $(LDLIBS) -o $@
|
||||||
|
|
||||||
$(lib): CFLAGS += -fpic
|
|
||||||
$(lib): $(lib_obj)
|
|
||||||
|
|
||||||
%.so:
|
%.so:
|
||||||
$(LINK.c) -shared $^ $(LDLIBS) -o $@
|
$(LINK.c) -shared $^ $(LDLIBS) -o $@
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user