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