File:  [Public anonymous repository] / mmondor / tests / bktr_client / GNUmakefile
Revision 1.8: download - view: text, annotated - select for diffs - revision graph
Mon Sep 13 02:42:52 2010 UTC (4 years, 2 months ago) by mmondor
Branches: MAIN
CVS tags: HEAD
- Use ffmpeg to load play/pause PNG images to a YUV format
- Blit again the play/pause button to the destination YUV overlay image

    1:	# $Id: GNUmakefile,v 1.8 2010/09/13 02:42:52 mmondor Exp $
    2:	
    3:	CC := cc
    4:	RM := rm
    5:	UNAME := uname
    6:	TOUCH := touch
    7:	OBJDUMP := objdump
    8:	OBJCOPY := objcopy
    9:	GREP := grep
   10:	AWK := awk
   11:	DATE := date
   12:	STRIP := strip
   13:	
   14:	TMPDIR := /tmp
   15:	
   16:	CFLAGS += -Wall
   17:	
   18:	# Enable for verbosity/debugging
   19:	#CFLAGS += -v -H -g
   20:	#LDFLAGS += -v -g
   21:	
   22:	# And to disable assertions
   23:	CFLAGS += -DNDEBUG
   24:	
   25:	# And to enable profiling
   26:	#CFLAGS += -pg
   27:	#LDFLAGS += -pg
   28:	
   29:	OBJS := $(addprefix src/,main.o)
   30:	BIN := bktr_client
   31:	RAWOBJS := $(addsuffix .o,$(addprefix img/,button_play.png button_pause.png)) \
   32:		$(addsuffix .o,$(addprefix key/,public.pem))
   33:	
   34:	SDL_CFLAGS := $(shell sdl-config --cflags)
   35:	SDL_LDFLAGS := $(shell sdl-config --libs)
   36:	SDL_LDFLAGS += -lSDL_net
   37:	
   38:	OPENSSL_CFLAGS :=
   39:	OPENSSL_LDFLAGS := -lcrypto
   40:	
   41:	FFMPEG_CFLAGS := $(shell pkg-config --cflags libavcodec libavformat libswscale)
   42:	FFMPEG_LDFLAGS := -Wl,-R$(shell pkg-config --variable=libdir libavcodec) \
   43:		$(shell pkg-config --libs libavcodec libavformat libswscale)
   44:	
   45:	# OS dependent settings follow
   46:	OS := $(shell $(UNAME) -s)
   47:	ifneq (,$(findstring CYGWIN,$(OS)))
   48:		# cygwin-mingw
   49:		CFLAGS += -mno-cygwin -I/usr/local/include -I/usr/include/mingw -DWIN32
   50:		LDFLAGS += -mwindows -mno-cygwin -L/usr/lib/mingw -L/usr/local/lib
   51:	else
   52:		# unix
   53:		CFLAGS += -I/usr/include -I/usr/pkg/include
   54:		LDFLAGS += -Wl,-R/usr/lib -L/usr/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/lib
   55:	endif
   56:	
   57:	# to compatible objects using objcopy and then link them like other modules.
   58:	OBJTARGET := $(shell $(TOUCH) $(TMPDIR)/obj.c && \
   59:		$(CC) $(CFLAGS) -c -o $(TMPDIR)/obj.o $(TMPDIR)/obj.c && \
   60:		$(OBJDUMP) -t $(TMPDIR)/obj.o | \
   61:		$(GREP) 'file format' | $(AWK) '{print $$4}' \
   62:		&& $(RM) $(TMPDIR)/obj.o $(TMPDIR)/obj.c)
   63:	OBJARCH := $(shell echo $(OBJTARGET) | $(AWK) -F '-' '{print $$2}')
   64:	SEED := $(shell date +%s)
   65:	
   66:	# Architecture independent settings follow
   67:	CFLAGS += -DBIG_ENDIAN=4321 -DLITTLE_ENDIAN=1234
   68:	ifeq ($(OBJARCH),i386)
   69:		CFLAGS += -DBYTE_ORDER=LITTLE_ENDIAN
   70:	else
   71:		CFLAGS += -DBYTE_ORDER=BIG_ENDIAN
   72:	endif
   73:	
   74:	CFLAGS += $(SDL_CFLAGS) $(OPENSSL_CFLAGS) $(FFMPEG_CFLAGS)
   75:	LDFLAGS += $(SDL_LDFLAGS) $(OPENSSL_LDFLAGS) $(FFMPEG_LDFLAGS)
   76:	
   77:	all: $(BIN)
   78:	
   79:	%.o: %.c
   80:		$(CC) -c $(CFLAGS) -o $@ $<
   81:	
   82:	$(RAWOBJS):
   83:		$(OBJCOPY) -I binary -B $(OBJARCH) -O $(OBJTARGET) $(basename $@) $@
   84:	
   85:	$(BIN): $(OBJS) $(RAWOBJS)
   86:		$(CC) -o $@ $(OBJS) $(RAWOBJS) $(LDFLAGS)
   87:		$(STRIP) -s -w -R .comment -R .ident -R .debug* $@*
   88:	
   89:	clean:
   90:		$(RM) -f $(BIN) $(BIN).exe $(OBJS) $(RAWOBJS) stdout.txt stderr.txt