Skip to content

Conversation

@grimreaper
Copy link

No description provided.

@singpolyma
Copy link

I agree with using a Makefile, but the given Makefile is needlessly verbose. You should make use of the features of make (such as: you can elide the *.o: rules since they just duplicate the defaults, and use $(RM) instead of rm -f, etc).

@singpolyma
Copy link

Significantly less verbose Makefile: http://pastie.org/4695846 (the /usr/local things should be optional too, since the compiler should have all sources set up, unless they are not set up properly on FreeBSD, which is why I left them in, since they were in the original).

@grimreaper
Copy link
Author

.PHONY: clean is the GNU make version;
clean: . PHONY is the pmake and bmake version - which is why I left it out

$^ and $@ are also GNU specific; bmake has $.IMPSRC and $.TARGET

The makefile I gave above should be portable to both GNU and BSD and other POSIX make systems. Since this isn't a large project using the "nicer" features isn't needed.

@singpolyma
Copy link

$@ is POSIX http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html apparently $^ is called $< in POSIX, but only expands to one of the files, and yeah .PHONY is not standard. I am sad that I did not know this, I really should have.

The implicit targets are definitely in POSIX, which was the real point of my change.

Sorry for my errors there. I should know better.

@grimreaper
Copy link
Author

Wow! I should have known better given that I work with POSIX and make on a daily basis. Thank you for enlightening me.

I agree with the standard part of your changes then. I'll try to commit them and add them to the pull request unless kmcallister gets to it first :)

@kmcallister
Copy link
Owner

Hmm, I think the controversy over what kind of Makefile to have vindicates my opinion that using make on this project would be a net loss. ;)

Anyway, I pushed changes which should fix the build on FreeBSD, and allow the user to override the choice of C compiler using $CC. Please let me know if there are any remaining build issues. (I might be able to do my own testing on FreeBSD but not for a little while.)

a makefile is nice because its the "standard" unix way. programmers expect to be able to run "make" when compiling a new utility. in addition package managers typically need explicit support for non-make solutions.

To be honest, I'm not that interested in packaging taralli for mass consumption. It's just a quick hack I threw together, and I thought it might be useful to some fellow programmers, who are willing to read the README and run a shell script.

This is just a matter of laziness on my part. If someone else wants to take taralli as a starting point for a packaged program with Xinerama support, a configure script (to find X libraries), a Makefile, a man page, a config file, and a sweet website, I'd be happy to see that.

@singpolyma
Copy link

What controversy? The original was fine but verbose, then I made a mistake, I got corrected, done.

Controversy should involve more disagreeing ;)

@barak
Copy link

barak commented Sep 12, 2012

I also wrote a Makefile, for my own building purposes. It uses GNU make extensions. git://github.com/barak/taralli commit 834a421.

As an overall note: there is no particular technical reason not to have both build.sh and Makefile

@plouj
Copy link

plouj commented Sep 20, 2012

I actually ran into:

main.c:(.text.startup+0x25): undefined reference to `XOpenDisplay'
main.c:(.text.startup+0x62): undefined reference to `XQueryExtension'
main.c:(.text.startup+0xc6): undefined reference to `XISelectEvents'
main.c:(.text.startup+0xdc): undefined reference to `XNextEvent'
main.c:(.text.startup+0x103): undefined reference to `XGetEventData'
main.c:(.text.startup+0x121): undefined reference to `XFreeEventData'
main.c:(.text.startup+0x150): undefined reference to `XQueryPointer'
main.c:(.text.startup+0x1ab): undefined reference to `XWarpPointer'

until I re-ordered the link arguments in the shell script like so:

diff --git a/build.sh b/build.sh
index 71d6bea..10c0b00 100755
--- a/build.sh
+++ b/build.sh
@@ -14,5 +14,5 @@ fi
 set -xe

 ${CC:-cc} -O2 -Wall -std=c99 -pedantic             \
-  -I/usr/local/include -L/usr/local/lib -lX11 -lXi \
-  -o taralli_$1 main.c map_$1.c
+  -I/usr/local/include -L/usr/local/lib \
+  -o taralli_$1 main.c -lX11 -lXi map_$1.c

in Ubuntu 12.04

See: http://stackoverflow.com/questions/8984408/linker-problems-in-ubuntu-11-10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants