On Mon, 2017-01-23, fl wrote:
> On Monday, January 23, 2017 at 3:13:24 PM UTC-5, fl wrote:
>> Hi,
...
> In fact, I've been learning makefile a few times. Now the makefiles
> in Ubuntu are more involved, for it having a subdirectory makefile.
>
> In the following snippet, I know libsmctc.a is a make target.
> But '$(SMCC) Makefile' is puzzling. $(SMCC) is like a parameter to put into
> Makefile?
You mean
libsmctc.a: $(SMCC) Makefile
Have you tried reading the Make manual? $(SMCC) is variable expansion,
much like C++ macros. So that's the same thing as
libsmctc.a: rng.cc history.cc smc-exception.cc Makefile
That looks like a really badly-written Makefile. A static library
should simply depend on the object files you want to put into it:
libsmctc.a: rng.o history.o smc-exception.o
$(AR) rcs $@ $^
> Second, $(CC) and $(CCFLAGS) have default values in the Makefile?
Gnu Make (which you're using, since you're on Linux) predefines some
names. But something is a bit off here:
- $(CC) is the name of the C compiler; the C++ compiler is called $(CXX).
- $(CCFLAGS) looks like one of the predefined names, but the C compiler
options are called $(CFLAGS) and the C++ ones $(CXXFLAGS).
A Makefile can use any names it wants, but not choosing the standard
names certainly makes things harder.
> -----------------
> SMCC = rng.cc history.cc smc-exception.cc
> SMCO = rng.o history.o smc-exception.o
>
> ...
>
> libsmctc.a: $(SMCC) Makefile
> $(CC) $(CCFLAGS) -c -I../include $(SMCC)
> ar rcs libsmctc.a $(SMCO)
> cp libsmctc.a ../lib
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/
snipabacken.se> O o .