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

Makefile for building inih as static library #24

Closed
GoogleCodeExporter opened this issue Mar 12, 2015 · 7 comments
Closed

Makefile for building inih as static library #24

GoogleCodeExporter opened this issue Mar 12, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

Hello,

I am packaging dunst software into Fedora and our rules does not allow 
embedding libraries. Would you accept this Makefile so linux distributions 
could make static packages of your library?

It does not have to be called "Makefile", I would be fine with 
"Makefile.static" or "Makefile.dist". It would be also possible to include the 
file in the extra/ directory (but some paths would need to be changed).

More details here: https://fedorahosted.org/fpc/ticket/216

Thank you in advance. This is the Makefile (attaching it as well because of 
TABs):

# 
# Simple makefile to build inih as static library.
#

SRC = ini.c
OBJ = $(SRC:.c=.o)
OUT = libinih.a
INCLUDES = -I.
CCFLAGS = -g -O2
CCC = g++
LDFLAGS = -g

.SUFFIXES: .cpp

default: $(OUT)

.cpp.o:
    $(CCC) $(INCLUDES) $(CCFLAGS) $(EXTRACCFLAGS) -c $< -o $@

$(OUT): $(OBJ)
    ar rcs $(OUT) $(OBJ)

clean:
    rm -f $(OBJ) $(OUT)

Original issue reported on code.google.com by lu...@zapletalovi.com on 8 Oct 2012 at 2:38

Attachments:

@GoogleCodeExporter
Copy link
Author

Looks reasonable, and thanks for the simple Makefile!

To be honest, I'm not sure I want to support a Makefile in inih itself, just 
because everyone will want slightly different CCFLAGS, or want to use gcc vs 
g++ or something (why g++ in this case, for instance? will it link against 
gcc-compiled code?).

Is there kind of Linux-y Makefile template for simple static libraries?

However, I would consider adding such a Makefile in an extra directory if you 
can modify it for that. Let me know.

Original comment by benh...@gmail.com on 8 Oct 2012 at 8:13

@GoogleCodeExporter
Copy link
Author

Hello, I understand. Well, I could prepare whole GNU autotools machinery for 
you, but I think you would prefer simple approach. Therefore I have prepared 
simple makefile that works in a subdirectory. I recommend to give it an 
extension linux and static in the format you would prefer, so others can add 
more makefiles if they need to.

Many thanks for including this in upstream - makes my life easier. And would 
you mind releasing new version of the library once you merge the change? 
Otherwise I will need to create svn snapshot release which is extra work too ;-)

[lzap@lzapx extra]$ cat Makefile.linux_static 
# 
# Simple makefile to build inih as static library.
#

SRC = ../ini.c
OBJ = $(SRC:.c=.o)
OUT = libinih.a
INCLUDES = -I..
CCFLAGS = -g -O2
CCC = g++
LDFLAGS = -g

.SUFFIXES: .cpp

default: $(OUT)

.cpp.o:
    $(CCC) $(INCLUDES) $(CCFLAGS) $(EXTRACCFLAGS) -c $< -o $@

$(OUT): $(OBJ)
    ar rcs $(OUT) $(OBJ) $(EXTRAARFLAGS)

clean:
    rm -f $(OBJ) $(OUT)

Original comment by lu...@zapletalovi.com on 9 Oct 2012 at 9:52

Attachments:

@GoogleCodeExporter
Copy link
Author

By the way there are EXTRACCFLAGS and EXTRAARFLAGS variables that can be set by 
distributors - I will use them in Fedora (I need to set some Fedora-related 
flags).

Original comment by lu...@zapletalovi.com on 9 Oct 2012 at 9:53

@GoogleCodeExporter
Copy link
Author

Okay, thanks. I committed your Makefile and made a few tweaks to it in r26.

It didn't actually work for me as is without the ".cpp.o" -> ".c.o" change.

Let me know if this works for you or if there are any changes required, and 
then I'll package it up as a release.

Original comment by benh...@gmail.com on 9 Oct 2012 at 8:38

@GoogleCodeExporter
Copy link
Author

Thank you, I will prepare Fedora package (can take few days) and let you know.

Original comment by lu...@zapletalovi.com on 10 Oct 2012 at 10:53

@GoogleCodeExporter
Copy link
Author

Package was created, everything works fine. Thank you:

https://bugzilla.redhat.com/show_bug.cgi?id=865116

Original comment by lu...@zapletalovi.com on 10 Oct 2012 at 8:52

@GoogleCodeExporter
Copy link
Author

Okay, great. I've uploaded the release as inih_r26.zip, so you should be good 
to go.

Original comment by benh...@gmail.com on 10 Oct 2012 at 9:10

  • Changed state: Verified

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

No branches or pull requests

1 participant