mirror of
https://github.com/troglobit/editline.git
synced 2025-05-06 04:21:24 +08:00
Simplify and clarify example
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
791508a3a1
commit
5be965deec
38
README.md
38
README.md
@ -70,39 +70,51 @@ availble in the source tree.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Compile the example, either by hard-coding the paths to the include
|
3. Compile the example:
|
||||||
file and the library:
|
|
||||||
|
|
||||||
cd ~/src/
|
cd ~/src/
|
||||||
make LDLIBS=-leditline example
|
make LDLIBS=-leditline example
|
||||||
|
|
||||||
In this example I use `make` and rely on its implicit (built-in) rules
|
Here I use `make` and rely on its implicit (built-in) rules to handle
|
||||||
to handle all the magic with `gcc`, but you may want to create your own
|
all the compiler magic, but you may want to create your own Makefile for
|
||||||
Makefile for the project. In particular if you don't change the default
|
the project. In particular if you don't change the default prefix
|
||||||
prefix (above), because then you need to specify the search path for the
|
(above), because then you need to specify the search path for the
|
||||||
include file(s) and the library manually. A simple `~/src/Makefile`:
|
include file(s) and the library manually.
|
||||||
|
|
||||||
|
A simple `~/src/Makefile` could look like this:
|
||||||
|
|
||||||
CFLAGS = -I/usr/local/include
|
CFLAGS = -I/usr/local/include
|
||||||
LDFLAGS = -L/usr/local/lib
|
LDFLAGS = -L/usr/local/lib
|
||||||
LDLIBS = -leditline
|
LDLIBS = -leditline
|
||||||
|
EXEC = example
|
||||||
|
OBJS = example.o
|
||||||
|
|
||||||
all: example
|
all: $(EXEC)
|
||||||
|
|
||||||
|
$(EXEC): $(OBJS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(OBJS) $(EXEC)
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
$(RM) *.o *~ *.bak
|
||||||
|
|
||||||
Then simply type `make` from your `~/src/` directory. You can also use
|
Then simply type `make` from your `~/src/` directory. You can also use
|
||||||
`pkg-config` for your `~/src/Makefile`:
|
`pkg-config` for your `~/src/Makefile`, replace the following lines:
|
||||||
|
|
||||||
CFLAGS = $(shell pkg-config --cflags libeditline)
|
CFLAGS = $(shell pkg-config --cflags libeditline)
|
||||||
LDFLAGS = $(shell pkg-config --libs-only-L libeditline)
|
LDFLAGS = $(shell pkg-config --libs-only-L libeditline)
|
||||||
LDLIBS = $(shell pkg-config --libs-only-l libeditline)
|
LDLIBS = $(shell pkg-config --libs-only-l libeditline)
|
||||||
|
|
||||||
all: example
|
Then simply type <kbd>make</kbd>, like above.
|
||||||
|
|
||||||
Then simply type <kbd>make</kbd>, like above. However, in most `.rpm`
|
However, most `.rpm` based distributions `pkg-config` doesn't search in
|
||||||
based distributions `pkg-config` doesn't search in `/usr/local` anymore,
|
`/usr/local` anymore, so you need to call make like this:
|
||||||
so you need to call make like this:
|
|
||||||
|
|
||||||
PKG_CONFIG_LIBDIR=/usr/local/lib/pkgconfig make
|
PKG_CONFIG_LIBDIR=/usr/local/lib/pkgconfig make
|
||||||
|
|
||||||
|
Debian/Ubuntu based systems do not have this problem.
|
||||||
|
|
||||||
|
|
||||||
API
|
API
|
||||||
---
|
---
|
||||||
|
Loading…
Reference in New Issue
Block a user