-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
50 lines (39 loc) · 988 Bytes
/
Makefile
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
46
47
48
49
50
############################################################################
# Makefile for run length encode/decode library and sample program
############################################################################
CC = gcc
LD = gcc
CFLAGS = -O3 -Wall -Wextra -pedantic -ansi -c
LDFLAGS = -O3 -o
# libraries
LIBS = -L. -Loptlist -lrle -loptlist
# Treat NT and non-NT windows the same
ifeq ($(OS),Windows_NT)
OS = Windows
endif
ifeq ($(OS),Windows)
EXE = .exe
DEL = del
else #assume Linux/Unix
EXE =
DEL = rm -f
endif
all: sample$(EXE)
sample$(EXE): sample.o librle.a optlist/liboptlist.a
$(LD) $< $(LIBS) $(LDFLAGS) $@
sample.o: sample.c rle.h optlist/optlist.h
$(CC) $(CFLAGS) $<
librle.a: rle.o vpackbits.o
ar crv $@ $^
ranlib $@
rle.o: rle.c
$(CC) $(CFLAGS) $<
vpackbits.o: vpackbits.c
$(CC) $(CFLAGS) $<
optlist/liboptlist.a:
cd optlist && $(MAKE) liboptlist.a
clean:
$(DEL) *.o
$(DEL) *.a
$(DEL) sample$(EXE)
cd optlist && $(MAKE) clean