| 1 |
######################################################################## |
| 2 |
# Code listing from "Advanced Linux Programming," by CodeSourcery LLC # |
| 3 |
# Copyright (C) 2001 by New Riders Publishing # |
| 4 |
# See COPYRIGHT for license information. # |
| 5 |
######################################################################## |
| 6 |
|
| 7 |
OBJECTS = readfile.o temp_file.o test.o |
| 8 |
LIBRARIES = libtest.a libtest.so |
| 9 |
PROGRAMS = app arglist client getopt_long print-env tifftest |
| 10 |
|
| 11 |
.PHONY: all clean |
| 12 |
|
| 13 |
# Default target: build everything. |
| 14 |
all: $(OBJECTS) $(LIBRARIES) $(PROGRAMS) |
| 15 |
|
| 16 |
# Clean up build products. |
| 17 |
clean: |
| 18 |
rm -f *.o *.a $(PROGRAMS) |
| 19 |
|
| 20 |
# Additional dependencies. |
| 21 |
main: reciprocal.o |
| 22 |
|
| 23 |
libtest.a: test.o |
| 24 |
ar cr $@ $? |
| 25 |
|
| 26 |
libtest.so: test.c |
| 27 |
$(CC) $(CFLAGS) -fPIC -shared $< -o $@ |
| 28 |
|
| 29 |
app: LDLIBS += -L. -ltest |
| 30 |
app: app.c libtest.a |
| 31 |
|
| 32 |
tifftest: CFLAGS += -static |
| 33 |
tifftest: LDLIBS += -ltiff -ljpeg -lz |