Ricardo Nabinger Sanchez ([info]rnsanchez) wrote,
  • Mood: nerdy
  • Music: Philippe Vachey - LBA's Theme

What happens if a C programmer "goes" Java?

He will use a Makefile to handle all javac stuff. A neat, well-indented and with as least as possible rules (featuring a single suffix rule, also), by the way.

Here's a nice (and real) output, proving that life is happier (and a lot easier) with make and Makefiles:


javac -d ../../bin -cp ../../bin/:../../jars/log4j.jar:../../jars/smack.jar:../../jars/bcprov-jdk15-124.jar ModulesSettingsHandler.java
Note: ModulesSettingsHandler.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
javac -d ../../bin -cp ../../bin/:../../jars/log4j.jar:../../jars/smack.jar:../../jars/bcprov-jdk15-124.jar SecurityModule.java
javac -d ../../bin -cp ../../bin/:../../jars/log4j.jar:../../jars/smack.jar:../../jars/bcprov-jdk15-124.jar Log.java
javac -d ../../bin -cp ../../bin/:../../jars/log4j.jar:../../jars/smack.jar:../../jars/bcprov-jdk15-124.jar MessageHandler.java
Note: MessageHandler.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
javac -d ../../bin -cp ../../bin/:../../jars/log4j.jar:../../jars/smack.jar:../../jars/bcprov-jdk15-124.jar PgpEncryption.java
javac -d ../../bin -cp ../../bin/:../../jars/log4j.jar:../../jars/smack.jar:../../jars/bcprov-jdk15-124.jar PgpSignature.java


Notes:
[1] This is real. I dislike ant, which is a lot harder to use (xml is for bots, not humans!)
[2] I am not quitting C (not even planned for the next 15 years)
[3] These are some files from the P2P security layer, Detsch's master thesis work.

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    Your reply will be screened

    Your IP address will be recorded 

  • 7 comments

[info]fmierlo

July 18 2005, 16:15:55 UTC 6 years ago

Alternative for ant

Have you tried scons [1]?

This guy is like a Makefile, but with a autotools and ccache build-in.

1. http://www.scons.org/

[info]fmierlo

July 18 2005, 16:16:55 UTC 6 years ago

Re: Alternative for ant

I forgot to say, and it's cross-platform.

[info]rnsanchez

July 18 2005, 18:47:33 UTC 6 years ago

Re: Alternative for ant

very nice! :)

it has even a (n apparently) great support for java stuff.

the nice thing with make is that you learn a lot from what you're coding (the code shown here is not mine, but I'll maintain it for some time).

perhaps, if someone can write a Makefile for something that really works (ie, not using cheats, like makedepend or autotools), that's half-way to full understanding of what he/she is working on.

size doesn't matter -- the Linux kernel uses hand tunned Makefiles, AFAIK. and I consider it a big project :)

[info]hisham

July 18 2005, 17:32:12 UTC 6 years ago

If you have to use make/ant...

then Java failed.

Java is supposed to build a program "intelligently" just given the path of the main class. Of course, we know this does not happen in practice -- personally, I used simple build.sh scripts back in my Java days. Today, I'd probably use a Makefile (since now I'm kinda turned into -- the horror! -- a C programmer).

With fpc I never needed a build script/makefile. Given the main program, it always did dependency checking and on-demand compilation perfectly. Good language design goes a long way.

[info]rnsanchez

July 18 2005, 18:51:03 UTC 6 years ago

Re: If you have to use make/ant...

write this down, please:

"When the time comes, assembly will prove itself as the only true portable and maintainable language (specially RISC assembly). It's the only language error-proof on its roots. IE, unless you rot13 your source, no "compiler" can fail to 1:1 translate your txt into machine code (only crap compilers, of course, but those will not survive either)"

Perhaps this is my first "postulate" or law.
:)

[info]hisham

July 18 2005, 20:00:18 UTC 6 years ago

Mind-boggled

Still absorbed in the shock of trying to understand assembly as a portable language.

:-O

[info]ferhr

July 18 2005, 22:10:01 UTC 6 years ago

Re: If you have to use make/ant...

Right in the head. When I have to do a global "make", I do the following:

for i in `find * | grep -i java | (tons of grep -v's)`; do javac $i; done 2> err.txt.

This happens once a day. Just once. 80% of the time it returns "zero" lines.
Create an Account
Forgot your login or password?
Facebook Twitter More login options
English • Español • Deutsch • Русский…