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 \
92 deark-user.o deark-unix.o deark-win.o
)
93 OFILES_DEARK2
:=$(addprefix $(OBJDIR
)/src
/,deark-modules.o
)
94 OFILES_ALL
:=$(OFILES_DEARK1
) $(OFILES_DEARK2
) $(OFILES_MODS
) $(OBJDIR
)/src
/deark-cmd.o
$(DEARK_RC_O
)
96 DEARK1_A
:=$(OBJDIR
)/src
/deark1.a
97 $(DEARK1_A
): $(OFILES_DEARK1
)
98 $(AR
) $(ARFLAGS
) $@
$^
100 DEARK2_A
:=$(OBJDIR
)/src
/deark2.a
101 $(DEARK2_A
): $(OFILES_DEARK2
)
102 $(AR
) $(ARFLAGS
) $@
$^
104 MODS_AB_A
:=$(OBJDIR
)/modules
/mods-ab.a
105 MODS_CH_A
:=$(OBJDIR
)/modules
/mods-ch.a
106 MODS_IO_A
:=$(OBJDIR
)/modules
/mods-io.a
107 MODS_PQ_A
:=$(OBJDIR
)/modules
/mods-pq.a
108 MODS_RZ_A
:=$(OBJDIR
)/modules
/mods-rz.a
109 $(MODS_AB_A
): $(OFILES_MODS_AB
)
110 $(AR
) $(ARFLAGS
) $@
$^
111 $(MODS_CH_A
): $(OFILES_MODS_CH
)
112 $(AR
) $(ARFLAGS
) $@
$^
113 $(MODS_IO_A
): $(OFILES_MODS_IO
)
114 $(AR
) $(ARFLAGS
) $@
$^
115 $(MODS_PQ_A
): $(OFILES_MODS_PQ
)
116 $(AR
) $(ARFLAGS
) $@
$^
117 $(MODS_RZ_A
): $(OFILES_MODS_RZ
)
118 $(AR
) $(ARFLAGS
) $@
$^
120 # I'm sorry if your linker doesn't like this library order, but the link
121 # command was getting so long that I've decided to start using helper
122 # libraries. I'll consider adding "-Wl,--start-group" and "-Wl,--end-group"
123 # options if that would help.
124 $(DEARK_EXE
): $(OBJDIR
)/src
/deark-cmd.o
$(DEARK_RC_O
) $(DEARK2_A
) $(MODS_AB_A
) \
125 $(MODS_CH_A
) $(MODS_IO_A
) $(MODS_PQ_A
) $(MODS_RZ_A
) $(DEARK1_A
)
126 $(CC
) $(LDFLAGS
) -o
$@
$^
129 $(CC
) $(CFLAGS
) $(INCLUDES
) -c
-o
$@
$<
132 $(DEARK_RC_O
): src
/deark.rc
133 $(DEARK_WINDRES
) $< $@
138 DEARK_INSTALLDIR ?
= /usr
/local
/bin
139 INSTALL_TARGET
:=$(DEARK_INSTALLDIR
)/$(DEARK_EXE_BASENAME
)
140 install: $(INSTALL_TARGET
)
141 $(INSTALL_TARGET
): $(DEARK_EXE
)
142 install -s
$(DEARK_EXE
) $(DEARK_INSTALLDIR
)
144 # Quick & dirty man page generation. (experimental/temporary)
145 .PHONY
: man install-man
147 $(DEARK_MAN
): $(DEARK_EXE
)
148 help2man
-n
"extract data from various file formats" -o
$@
-N
$(DEARK_EXE
)
149 install-man
: $(DEARK_MAN
)
150 install $(DEARK_MAN
) /usr
/share
/man
/man1
153 rm -f
$(OBJDIR
)/src
/*.
[oad
] $(OBJDIR
)/modules
/*.
[oad
] $(DEARK_MAN
) $(DEARK_EXE
)
155 ifeq ($(MAKECMDGOALS
),dep
)
157 $(DEPS_MK
): $(OFILES_ALL
:.o
=.d
)
161 $(CC
) $(CFLAGS
) $(INCLUDES
) -MM
-MT
'$$(OBJDIR)/$*.o' -MF
$@
$<