1# Makefile for Zip, ZipCloak, ZipNote and ZipSplit for
2# THEOS ANSI C
3# To use, do "make -f theos/makefile"
4# This make file uses cl, a C compiler and linker driver written by
5# Jean-Michel Dubois. Send a mail to jmdubois@ibcfrance.fr to get it for free.
6# MAINWA_BUG    Workaround argument expansion failure
7# LOCATE_BUG    Workaround stat, fopen and open failure on relative paths to
8#               root dir.
9
10CC=cl
11CFLAGS=-Zi -W3 -DDYN_ALLOC -DCRYPT -DMAINWA_BUG -DLOCATE_BUG
12LD=cl -o
13LDFLAGS=-m -Zi
14AS=cc
15ASFLAGS=
16
17UTILFLAGS=-DUTIL $(CFLAGS) -Fo
18
19# variables
20
21# object file lists
22OBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o crypt.o ttyio.o \
23       theos.o crc32.o _fprintf.o _stat.o _chmod.o _isatty.o \
24       _setargv.o _rename.o
25OBJI = deflate.o trees.o
26OBJA =
27OBJU = zipfile_.o fileio_.o util_.o globals.o theos_.o _rename.o _stat.o \
28       _chmod.o _fprintf.o
29OBJN = zipnote.o  $(OBJU)
30OBJC = zipcloak.o $(OBJU) crc32_.o crypt_.o ttyio.o
31OBJS = zipsplit.o $(OBJU)
32
33OSDEP_H = theos/osdep.h
34ZIP_H = zip.h ziperr.h tailor.h $(OSDEP_H)
35
36ZIPS = zip.command zipnote.command zipsplit.command zipcloak.command
37
38zips:	$(ZIPS)
39
40zip.o:	zip.c $(ZIP_H) crc32.h crypt.h ttyio.h revision.h
41	$(CC) -c $(CFLAGS) $*.c
42
43zipfile.o:	zipfile.c $(ZIP_H) crc32.h
44	$(CC) -c $(CFLAGS) $*.c
45
46zipup.o:	zipup.c $(ZIP_H) revision.h crc32.h crypt.h
47	$(CC) -c $(CFLAGS) $*.c
48
49fileio.o:	fileio.c $(ZIP_H) crc32.h
50	$(CC) -c $(CFLAGS) $*.c
51
52util.o:	util.c $(ZIP_H) theos/charconv.h
53	$(CC) -c $(CFLAGS) $*.c
54
55globals.o:	globals.c $(ZIP_H)
56	$(CC) -c $(CFLAGS) $*.c
57
58crc32.o:	crc32.c $(ZIP_H) crc32.h
59	$(CC) -c $(CFLAGS) $*.c
60
61deflate.o:	deflate.c $(ZIP_H)
62	$(CC) -c $(CFLAGS) $*.c
63
64trees.o:	trees.c $(ZIP_H)
65	$(CC) -c $(CFLAGS) $*.c
66
67crypt.o:	crypt.c $(ZIP_H) crc32.h crypt.h
68	$(CC) -c $(CFLAGS) $*.c
69
70theos.o:	theos/theos.c $(ZIP_H)
71	$(CC) -c $(CFLAGS) -Fo$@ theos/theos.c
72
73_fprintf.o:	theos/_fprintf.c
74	$(CC) -c $(CFLAGS) -Fo$@ theos/_fprintf.c
75
76_stat.o:	theos/_stat.c
77	$(CC) -c $(CFLAGS) -Fo$@ theos/_stat.c
78
79_chmod.o:	theos/_chmod.c
80	$(CC) -c $(CFLAGS) -Fo$@ theos/_chmod.c
81
82_isatty.o:	theos/_isatty.c
83	$(CC) -c $(CFLAGS) -Fo$@ theos/_isatty.c
84
85_rename.o:	theos/_rename.c
86	$(CC) -c $(CFLAGS) -Fo$@ theos/_rename.c
87
88_setargv.o:	theos/_setargv.c
89	$(CC) -c $(CFLAGS) -Fo$@ theos/_setargv.c
90
91ttyio.o:	$(ZIP_H) ttyio.h ttyio.c
92	$(CC) -c $(CFLAGS) $*.c
93
94zipcloak.o:	zipcloak.c $(ZIP_H) crc32.h crypt.h ttyio.h revision.h
95	$(CC) -c $(CFLAGS) $*.c
96
97zipnote.o:	zipnote.c $(ZIP_H) revision.h
98	$(CC) -c $(CFLAGS) $*.c
99
100zipsplit.o:	$(ZIP_H) revision.h
101	$(CC) -c $(CFLAGS) $*.c
102
103zipfile_.o:	zipfile.c $(ZIP_H) crc32.h
104	$(CC) -c $(UTILFLAGS)$@ zipfile.c
105
106fileio_.o:	fileio.c $(ZIP_H) crc32.h
107	$(CC) -c $(UTILFLAGS)$@ fileio.c
108
109theos_.o:	theos/theos.c $(ZIP_H)
110	$(CC) -c $(UTILFLAGS)$@ theos/theos.c
111
112util_.o:	util.c $(ZIP_H)
113	$(CC) -c $(UTILFLAGS)$@ util.c
114
115crc32_.o:	crc32.c $(ZIP_H) crc32.h
116	$(CC) -c $(UTILFLAGS)$@ $*.c
117
118crypt_.o:	crypt.c $(ZIP_H) crc32.h crypt.h
119	$(CC) -c $(UTILFLAGS)$@ crypt.c
120
121zip.command: $(OBJZ) $(OBJI)
122	$(LD) $@ $(OBJZ) $(OBJI) $(LDFLAGS)
123
124zipcloak.command: $(OBJC)
125	$(LD) $@ $(OBJC) $(LDFLAGS)
126
127zipnote.command: $(OBJN)
128	$(LD) $@ $(OBJN) $(LDFLAGS)
129
130zipsplit.command: $(OBJS)
131	$(LD) $@ $(OBJS) $(LDFLAGS)
132
133install:	$(ZIPS)
134	copy *.command /system.cmd32.=(rep noq not
135
136clean:
137	erase *.o(noq not
138	erase *.command(noq not
139