LWN.net Logo

LCA: Disintermediating distributions

LCA: Disintermediating distributions

Posted Feb 7, 2008 8:49 UTC (Thu) by aleXXX (subscriber, #2742)
In reply to: LCA: Disintermediating distributions by stevenj
Parent article: LCA: Disintermediating distributions

> Skilled programmers don't have a hard time learning a new syntax. 

Yes, true (still why do I need multiple languages just to build 
software ?).
Anyway, but I was talking about students starting to learn C or C++. They 
have enough problems with C/C++ itself. Under Linux you can 

-require them to learn basic Makefile syntax: ok as long as the software 
is very simple (write makefile, then run make)

-require them to learn autoconf+automake+shell+Makefile: this is 
unrealistic (write Makefile.am, then write configure.in, then run 
automake, then run autoconf, then run configure, then run make)

-require them to learn e.g. cmake: ok, also for slightly more complicated 
things, as e.g. building a shared library and installing it (write 
CMakeLists.txt, run cmake, then run make or hit F8 in kdevelop)

Alex


(Log in to post comments)

LCA: Disintermediating distributions

Posted Feb 7, 2008 17:28 UTC (Thu) by stevenj (guest, #421) [Link]

Students just learning C and C++ for the first time are not going to be able to write non-trivial software that builds on a dozen different systems without modification. Or perhaps I should say, they are probably not going to be able to write non-trivial software on their own. (Or complex projects with more than a handful of source files, or shared libraries, or mix languages, etcetera.) No matter what build system you use, they are going to need help with packaging, porting, and distribution, not to mention many other aspects of the software development.

In short, the case of students just learning how to program is simply not relevant for the autotools, because the autotools address problems that those students aren't even close to dealing with. Yes, such students should be perfectly fine with raw 'make', and shouldn't try for configure scripts.

LCA: Disintermediating distributions

Posted Feb 7, 2008 22:38 UTC (Thu) by aleXXX (subscriber, #2742) [Link]

I agree, but not completely.

Having students write makefiles like:

foo: main.c foo.c
    gcc -Wall -O2 main.c foo.c -o foo

is ok, splitting this into separate rules for compiling and linking may 
still be ok. Actually I think it is a good thing if they learn how 
makefiles work.
But this is only acceptable for very simple projects (maybe I have become 
lazy). The next step from that to autotools is huge IMO. The step to 
cmake is small:

add_library(foolib SHARED foo.c bar.c)
add_executable(hello main.c)
target_link_libraries(hello foolib)

install(TARGETS hello DESTINATION bin)
install(TARGETS foolib DESTINATION lib)
install(FILES foo.h DESTINATION include)

I really think this is doable. I'd say that this is understandable even 
without reading documentation. 
It works on all platforms, including the shared lib. It creates MSVC 
projects if you want it, or Eclipse projects if you want that. It builds 
also out-of-source. It gives you complete targets: all, foolib, hello, 
install, clean, help (!), foo.o, foo.s, foo.E (!).
The good thing is basic things are very simple with cmake, and building 
on that you can add functionality/required configure checks one by one 
(not students, but if somebody actually wants to have the software 
portable).

Alex

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds