OSDN Git Service

remove global variables on maketree.c
[lha/olha.git] / makefile
1 CFLAGS=-g -DPROTOTYPES=1 -Wall
2 CPPFLAGS=-I.
3 ifeq (cygwin,$(patsubst CYGWIN%,cygwin,$(shell uname -s)))
4   EXEEXT=.exe
5 else
6   EXEEXT=
7 endif
8 OBJS1 = ar.o io.o encode.o decode.o maketree.o maketbl.o huf.o \
9         strlib.o pathlib.o filelib.o header.o add.o extract.o list.o \
10         error.o
11 OBJS2 = getopt_long.o
12
13 OBJS = $(OBJS1) $(OBJS2)
14
15 DEPS = $(OBJS:.o=.d)
16 TARGET = olha$(EXEEXT)
17
18 $(TARGET): $(OBJS)
19         $(CC) $(CFLAGS) $^ -o $@
20
21 proto:
22         sh ./cproto.sh $(OBJS1:.o=.c)
23
24 %.o: %.c
25         $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
26
27 clean:
28         $(RM) $(OBJS) $(TARGET) $(TARGET).stackdump
29
30 distclean: clean
31         $(RM) $(DEPS) tests/test.log
32
33 install: $(TARGET)
34         install -m 755 olha$(EXEEXT) /usr/local/bin
35
36 check: $(TARGET) randtest
37         sh ./tests/lha-test.sh 2 10 3 4 5 7 8 16 11
38         # 12: testing the end of line conversion.
39         # 13: testing the kanji code conversion.
40         # 14: testing to handle symbolic links
41         # 15: testing to self extracting archive
42         # 17: testing to remove relative path
43         # 18: restore directory permission
44         sh ./test.sh
45
46 t: $(TARGET)
47         cd t && python lha-test.py
48
49 randtest: $(TARGET)
50         cd ./randtest && PATH=..:$$PATH ruby randtest.rb
51
52 # include $(wildcard *.d)
53 include $(DEPS)
54
55 %.d: %.c
56         @echo creating $@
57         @set -e; $(CC) -M $(CPPFLAGS) $< \
58                 | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
59                 [ -s $@ ] || rm -f $@
60
61 .PHONY: clean distclean install check t randtest proto