include ../../config.mak

VPATH=$(SRC_PATH)/Applications/MP4Box

CFLAGS= $(OPTFLAGS) -Wall -I$(SRC_PATH)/include

ifeq ($(DEBUGBUILD), yes)
CFLAGS+=-g
LDFLAGS+=-g
endif

#file format is read-only
ifeq ($(GPACREADONLY), yes)
CFLAGS+= -DM4_READ_ONLY
endif

#common obj
OBJS= main.o filedump.o fileimport.o

LINKFLAGS=-L../../bin/gcc
ifeq ($(CONFIG_WIN32),yes)
EXE=.exe
PROG=MP4Box$(EXE)
#LINKFLAGS+=-lm4systems_static -lz
LINKFLAGS+=-lm4systems
else
EXT=
PROG=MP4Box
#LINKFLAGS+=-lm4systems_static $(EXTRALIBS) $(M4SH_FLAGS) -lz
LINKFLAGS+=-lm4systems
endif


SRCS := $(OBJS:.o=.c) 

all: $(PROG)

MP4Box$(EXE): $(OBJS)
	$(CC) $(LDFLAGS) -o ../../bin/gcc/$@ $(OBJS) $(LINKFLAGS)


%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $< 


clean: 
	rm -f $(OBJS) ../../bin/gcc/$(PROG)

dep: depend

depend:
	rm -f .depend	
	$(CC) -MM $(CFLAGS) $(SRCS) 1>.depend

distclean: clean
	rm -f Makefile.bak .depend



# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif
