2 CFLAGS ?
= -g
-O2
-Wall
-Wextra
-Wmissing-prototypes
-Wformat-security
-Wno-unused-parameter
6 OBJDIR
:=$(DEARK_OBJDIR
)
11 DEARK_RC_O
:=$(OBJDIR
)/src
/deark-rc.o
16 ARFLAGS
:=$(DEARK_ARFLAGS
)
23 ifeq ($(OS
),Windows_NT
)
28 DEARK_EXE_BASENAME
:=deark
$(EXE_EXT
)
29 DEARK_EXE
:=$(DEARK_EXE_BASENAME
)
35 DEARK_EXE
:=$(OBJDIR
)/$(DEARK_EXE_BASENAME
)
36 DEARK_MAN
:=$(OBJDIR
)/$(DEARK_MAN
)
37 DEPS_MK
:=$(OBJDIR
)/$(DEPS_MK
)
40 ifeq ($(MAKECMDGOALS
),dep
)
42 # Regenerate deps.mk only when someone runs "make dep".
43 # (I'm aware that there are ways to do this automatically, and that one might
44 # have to run "make clean" before "make dep" in some cases. But only
45 # developers need to worry about this. Everyone else can just run "make".)
56 .PHONY
: all clean dep
install
58 OFILES_MODS_AB
:=$(addprefix $(OBJDIR
)/modules
/,abk.o alphabmp.o amigaicon.o \
59 ansiart.o
ar.o asf.o atari-dsk.o atari-img.o autocad.o awbm.o basic-c64.o \
60 arcfs.o apm.o afcp.o arc.o amiga-dsk.o \
61 bmff.o apple2-dsk.o applesd.o binhex.o bintext.o bmi.o bmp.o \
63 OFILES_MODS_CH
:=$(addprefix $(OBJDIR
)/modules
/,cab.o cardfile.o cfb.o \
64 cpio.o d64.o drhalo.o ebml.o emf.o epocimage.o eps.o exe.o dms.o \
65 flif.o fnt.o gemfont.o gemmeta.o gemras.o gif.o grasp.o grob.o gzip.o \
66 hfs.o hlp.o dsstore.o fli.o fat.o flac.o ccx.o crush.o
)
67 OFILES_MODS_IO
:=$(addprefix $(OBJDIR
)/modules
/,misc.o iccprofile.o icns.o \
68 id3.o ico.o iff.o ilbm.o insetpix.o iptc.o jbf.o jovianvi.o jpeg.o lha.o \
69 j2c.o ogg.o olepropset.o iso9660.o macbinary.o macrsrc.o \
70 macpaint.o makichan.o mbk.o mp3.o mscompress.o msp.o nokia.o os2bmp.o ole1.o \
71 officeart.o lbr.o megapaint.o nie.o
)
72 OFILES_MODS_PQ
:=$(addprefix $(OBJDIR
)/modules
/,psd.o palmbitmap.o palmpdb.o \
73 pcpaint.o pcx.o pff2.o pict.o pkfont.o png.o pnm.o portfolio.o printptnr.o \
75 printshop.o psf.o psionapp.o psionpic.o pcf.o plist.o qtif.o
)
76 OFILES_MODS_RZ
:=$(addprefix $(OBJDIR
)/modules
/,riff.o rosprite.o rpm.o \
77 rsc.o shg.o spectrum512.o sunras.o t64.o
tar.o tga.o tiff.o tim.o \
78 tivariable.o unsupported.o vort.o wad.o wmf.o wpg.o wri.o xface.o \
79 stuffit.o sis.o sauce.o xfer.o zip.o zoo.o rodraw.o unifont.o
rm.o
)
80 OFILES_MODS
:=$(OFILES_MODS_AB
) $(OFILES_MODS_CH
) $(OFILES_MODS_IO
) \
81 $(OFILES_MODS_PQ
) $(OFILES_MODS_RZ
)
83 OFILES_DEARK1
:=$(addprefix $(OBJDIR
)/src
/,fmtutil-miniz.o deark-util.o \
84 deark-data.o deark-zip.o deark-tar.o deark-png.o \
85 deark-dbuf.o deark-bitmap.o deark-char.o deark-font.o deark-ucstring.o \
86 fmtutil.o fmtutil-cmpr.o fmtutil-advfile.o fmtutil-zip.o \
87 fmtutil-lzh.o fmtutil-lzw.o fmtutil-huffman.o \
88 deark-user.o deark-unix.o deark-win.o
)
89 OFILES_DEARK2
:=$(addprefix $(OBJDIR
)/src
/,deark-modules.o
)
90 OFILES_ALL
:=$(OFILES_DEARK1
) $(OFILES_DEARK2
) $(OFILES_MODS
) $(OBJDIR
)/src
/deark-cmd.o
$(DEARK_RC_O
)
92 DEARK1_A
:=$(OBJDIR
)/src
/deark1.a
93 $(DEARK1_A
): $(OFILES_DEARK1
)
96 DEARK2_A
:=$(OBJDIR
)/src
/deark2.a
97 $(DEARK2_A
): $(OFILES_DEARK2
)
100 MODS_AB_A
:=$(OBJDIR
)/modules
/mods-ab.a
101 MODS_CH_A
:=$(OBJDIR
)/modules
/mods-ch.a
102 MODS_IO_A
:=$(OBJDIR
)/modules
/mods-io.a
103 MODS_PQ_A
:=$(OBJDIR
)/modules
/mods-pq.a
104 MODS_RZ_A
:=$(OBJDIR
)/modules
/mods-rz.a
105 $(MODS_AB_A
): $(OFILES_MODS_AB
)
106 $(AR
) $(ARFLAGS
) $@
$^
107 $(MODS_CH_A
): $(OFILES_MODS_CH
)
108 $(AR
) $(ARFLAGS
) $@
$^
109 $(MODS_IO_A
): $(OFILES_MODS_IO
)
110 $(AR
) $(ARFLAGS
) $@
$^
111 $(MODS_PQ_A
): $(OFILES_MODS_PQ
)
112 $(AR
) $(ARFLAGS
) $@
$^
113 $(MODS_RZ_A
): $(OFILES_MODS_RZ
)
114 $(AR
) $(ARFLAGS
) $@
$^
116 # I'm sorry if your linker doesn't like this library order, but the link
117 # command was getting so long that I've decided to start using helper
118 # libraries. I'll consider adding "-Wl,--start-group" and "-Wl,--end-group"
119 # options if that would help.
120 $(DEARK_EXE
): $(OBJDIR
)/src
/deark-cmd.o
$(DEARK_RC_O
) $(DEARK2_A
) $(MODS_AB_A
) \
121 $(MODS_CH_A
) $(MODS_IO_A
) $(MODS_PQ_A
) $(MODS_RZ_A
) $(DEARK1_A
)
122 $(CC
) $(LDFLAGS
) -o
$@
$^
125 $(CC
) $(CFLAGS
) $(INCLUDES
) -c
-o
$@
$<
128 $(DEARK_RC_O
): src
/deark.rc
129 $(DEARK_WINDRES
) $< $@
134 DEARK_INSTALLDIR ?
= /usr
/local
/bin
135 INSTALL_TARGET
:=$(DEARK_INSTALLDIR
)/$(DEARK_EXE_BASENAME
)
136 install: $(INSTALL_TARGET
)
137 $(INSTALL_TARGET
): $(DEARK_EXE
)
138 install -s
$(DEARK_EXE
) $(DEARK_INSTALLDIR
)
140 # Quick & dirty man page generation. (experimental/temporary)
141 .PHONY
: man install-man
143 $(DEARK_MAN
): $(DEARK_EXE
)
144 help2man
-n
"extract data from various file formats" -o
$@
-N
$(DEARK_EXE
)
145 install-man
: $(DEARK_MAN
)
146 install $(DEARK_MAN
) /usr
/share
/man
/man1
149 rm -f
$(OBJDIR
)/src
/*.
[oad
] $(OBJDIR
)/modules
/*.
[oad
] $(DEARK_MAN
) $(DEARK_EXE
)
151 ifeq ($(MAKECMDGOALS
),dep
)
153 $(DEPS_MK
): $(OFILES_ALL
:.o
=.d
)
157 $(CC
) $(CFLAGS
) $(INCLUDES
) -MM
-MT
'$$(OBJDIR)/$*.o' -MF
$@
$<