# # Quick 'n dirty unix Makefile # # Mike Oliphant (oliphant@gtk.org) # CC?= gcc DESTDIR ?= prefix ?= /usr/local docdir ?= $(prefix)/share/doc/mp3gain mandir ?= $(prefix)/share/man/man1 CFLAGS+= -Wall -DHAVE_MEMCPY # all known MS Windows OS define the ComSpec environment variable ifdef ComSpec ifndef OSTYPE OSTYPE = win endif EXE_EXT = .exe else EXE_EXT = endif ifneq ($(OSTYPE),beos) INSTALL_PATH= $(prefix)/bin else INSTALL_PATH= $(HOME)/config/bin endif # BeOS doesn't have libm (it's all in libroot) ifneq ($(OSTYPE),beos) LIBS= -lm else # BeOS: without this it wants to use bcopy() :^) CFLAGS+= -DHAVE_MEMCPY endif # Could ask pkg-config for libmpg123 flags/libs. LIBS+= -lmpg123 ifeq ($(OSTYPE),win) # gnu windows resource compiler WINDRES = windres endif OBJS= mp3gain.o apetag.o id3tag.o gain_analysis.o rg_error.o ifeq ($(OSTYPE),win) RC_OBJ = VerInfo.o endif all: mp3gain mp3gain.1 mp3gain.1: mp3gain.sgml docbook-to-man $< > $@ $(RC_OBJ): $(WINDRES) $(RC_OBJ:.o=.rc) $(RC_OBJ) mp3gain: $(RC_OBJ) $(OBJS) $(CC) $(LDFLAGS) -o mp3gain $(OBJS) $(RC_OBJ) $(LIBS) ifeq ($(OSTYPE),beos) mimeset -f mp3gain$(EXE_EXT) endif install: all ifneq ($(OSTYPE),win) install '-Dt$(DESTDIR)$(INSTALL_PATH)' mp3gain$(EXE_EXT) install '-Dt$(DESTDIR)$(docdir)' README.method install '-Dt$(DESTDIR)$(mandir)' mp3gain.1 ifeq ($(OSTYPE),beos) mimeset -f "$(DESTDIR)$(INSTALL_PATH)/mp3gain$(EXE_EXT)" endif else @echo install target is not implemented on windows endif uninstall: ifneq ($(OSTYPE),win) -rm -f "$(INSTALL_PATH)/mp3gain$(EXE_EXT)" $(RM) '$(INSTALL_PATH)$(docndir)/README.method' $(RM) '$(INSTALL_PATH)$(mandir)/mp3gain.1' else @echo uninstall target is not implemented on windows endif clean: -rm -rf mp3gain$(EXE_EXT) mp3gain.zip $(OBJS) $(RC_OBJ) $(RM) mp3gain.1 dist: clean ifneq ($(OSTYPE),win) ifneq ($(OSTYPE),beos) zip -r mp3gain.zip * -x "CVS/*" "*/CVS/*" endif else @echo dist target is not implemented on windows and beos endif