File: Makefile

package info (click to toggle)
esdl 1.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,312 kB
  • ctags: 7,213
  • sloc: ansic: 13,621; erlang: 8,825; makefile: 294; sh: 228; objc: 181
file content (94 lines) | stat: -rwxr-xr-x 2,496 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#  Copyright (c) 2001 Dan Gudmundsson
#  See the file "license.terms" for information on usage and redistribution
#  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
# 
#     $Id$
#

OS_FLAG = unix

ifeq ($(OS_FLAG), mingw)
include ../win32_conf/mingw_vars.mk
else

  OGLDIR  = /usr

# Uncomment these if your opengl header is located in another directory than
# the usual $(OGLDIR)/include/GL/gl.h
#GL_INCLUDE_DIR      = OpenGL
#USE_GL_INCLUDE_DIR  = -DFULL_PATH_TO_GL_INCLUDE_DIR

  GL_LIBS		= -L$(OGLDIR)/lib -lGL -lGLU 
  GL_INCS		= -I$(OGLDIR)/include/$(GL_INCLUDE_DIR)

  SDL_LIBS		= $(shell sdl-config --libs)
  SDL_INCS		= $(shell sdl-config --cflags)

ifeq ($(ENABLE_SDL_TTF), yes)
  SDL_TTF_LIBS          = -lSDL_ttf
  SDL_TTF_INCS          =                     # specify if different from SDL
  SDL_TTF_HELPER        = esdl_ttf
  USE_SDL_TTF           = -D_USE_SDL_TTF
endif

ifeq ($(ENABLE_SDL_IMAGE), yes)
  SDL_IMAGE_LIBS        = -lSDL_image
  SDL_IMAGE_INCS        =                     # specify if different from SDL
  SDL_IMAGE_HELPER      = esdl_img
  USE_SDL_IMAGE         = -D_USE_SDL_IMAGE
endif

  LIBS			= $(GL_LIBS) $(SDL_LIBS) $(SDL_TTF_LIBS) \
                          $(SDL_IMAGE_LIBS) -lm 
  INCS                  = $(GL_INCS) $(SDL_INCS)  $(SDL_TTF_INCS) \
                          $(SDL_IMAGE_INCS) $(ERL_INCS)

  CFLAGS		= -g -O2 -funroll-loops -Wall -ffast-math -fpic \
			-fomit-frame-pointer $(USE_GL_INCLUDE_DIR) -DSHM \
                        $(USE_SDL_TTF) $(USE_SDL_IMAGE) \
			-DPTHREADS $(INCS)

  CLINKFLAGS 		=  -fpic -shared  

  SOEXT = so

## The driver part needs erlang includes
  ERL_DIR := $(shell erl -noshell -eval "io:format([126,115,126,110],[code:root_dir()])" -s erlang halt)
  ERL_INCS = -I$(ERL_DIR)/usr/include

  CC = gcc

endif

TARGETDIR = ../priv

GCC_O	= $(CC) -c $(CFLAGS) $<

# Files

Helpers		= esdl_wrapper esdl_gen esdl_spec esdl_util \
			esdl_video esdl_events esdl_audio \
			esdl_gl esdl_glu esdl_glext \
			$(SDL_TTF_HELPER) $(SDL_IMAGE_HELPER)

HelpersObjects	= $(Helpers:%=%.o)

# Targets

target:  $(TARGETDIR)/sdl_driver.$(SOEXT)

clean:  
	rm -f $(HelpersObjects) 
	rm -f ../priv/*.$(SOEXT) ../priv/sdlwrapper *.o
	rm -f *~ erl_crash.dump

%.o: %.c
	$(GCC_O)


$(TARGETDIR)/sdl_driver.$(SOEXT): esdl_driver.c $(HelpersObjects)
	$(CC) $(CFLAGS) $(CLINKFLAGS) $(ERL_INCS) $< $(HelpersObjects) \
		$(LIBS) -o $@