aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 61b281be015e10993338917f646d8d317093f5c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
.POSIX:

CONFIGFILE = config.mk
include $(CONFIGFILE)

OBJ =\
	libparsepsf.o

LIB_HDR =\
	libparsepsf.h

HDR =\
	$(LIB_HDR)

all: libparsepsf.a demo
$(OBJ): $(@:.o=.c) $(HDR)
libparsepsf.o: libparsepsf.c $(LIB_HDR)

libparsepsf.a: $(OBJ)
	$(AR) rc $@ $(OBJ)
	$(AR) ts $@ > /dev/null

.c.o:
	$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)

demo: demo.o libparsepsf.a
	$(CC) -o $@ $@.o libparsepsf.a $(LDFLAGS)

install: libparsepsf.a
	mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
	mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
	cp -- libparsepsf.a "$(DESTDIR)$(PREFIX)/lib"
	cp -- libparsepsf.h "$(DESTDIR)$(PREFIX)/include"

uninstall:
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libparsepsf.a"
	-rm -f -- "$(DESTDIR)$(PREFIX)/include/libparsepsf.h"

clean:
	-rm -f -- *.o *.lo *.su *.a *.so *.so.* demo

.SUFFIXES:
.SUFFIXES: .c .o

.PHONY: all install uninstall clean