Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a make target for libraries #94

Open
zostay opened this issue May 26, 2015 · 1 comment
Open

Provide a make target for libraries #94

zostay opened this issue May 26, 2015 · 1 comment

Comments

@zostay
Copy link

zostay commented May 26, 2015

I am compelled to make this suggestion by the homebrew team as part of my attempt to add a linenoise formula there. To make linenoise install as a library on OS X, the following patch is required to the Makefile:

+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,15 @@
++all: liblinenoise.dylib linenoise_example
++
++liblinenoise.dylib: linenoise.o
++  $(CC) -dynamiclib -o liblinenoise.dylib linenoise.o
++
++%.o: %.c
++  $(CC) $(CFLAGS) -o $@ -c $<
++
+ linenoise_example: linenoise.h linenoise.c
+
+ linenoise_example: linenoise.c example.c
+   $(CC) -Wall -W -Os -g -o linenoise_example linenoise.c example.c
+
+ clean:
+-  rm -f linenoise_example
++  rm -f linenoise_example liblinenoise.dylib

Something like this would be handy for packaging systems wishing to install linenoise as a dynamic library and is further handy to bindings in languages like Perl 6 which work best with dynamic libraries. Obviously, this patch is not useful in a general way as it only works on OS X.

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

No branches or pull requests

2 participants