Makefile
author Ryan C. Gordon <icculus@icculus.org>
Sun, 08 Jul 2001 05:27:05 +0000
changeset 21 b1ea58d70a56
parent 20 efdde0d21521
child 22 49f6101707b4
permissions -rw-r--r--
Archive implementation (Build Groupfiles), other tweaks.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
# PhysicsFS -- A filesystem abstraction.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
#  Please see the file LICENSE in the source's root directory.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
#   This file written by Ryan C. Gordon.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
# Makefile for building PhysicsFS on Unix-like systems. Follow the
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
#  instructions for editing this file, then run "make" on the command line.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    14
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    16
# Set to your liking.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
CC = gcc
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
LINKER = gcc
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
# If this makefile fails to detect Cygwin correctly, or you want to force
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
#  the build process's behaviour, set it to "true" or "false" (w/o quotes).
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
#cygwin := true
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
#cygwin := false
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
cygwin := autodetect
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
# Set this to true if you want to create a debug build.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
#debugging := false
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    34
debugging := true
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    35
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
# Set the archive types you'd like to support.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    38
#  Note that various archives may need external libraries.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
use_archive_zip := false
21
b1ea58d70a56 Archive implementation (Build Groupfiles), other tweaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 20
diff changeset
    41
use_archive_grp := true
9
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    42
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    43
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    44
# Set to "true" if you'd like to build a DLL. Set to "false" otherwise.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    45
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
#build_dll := false
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
build_dll := true
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
# Set one of the below. Currently, none of these are used.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52
#use_asm = -DUSE_I386_ASM
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    53
use_asm = -DUSE_PORTABLE_C
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    54
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    55
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    56
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    57
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    58
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    59
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    60
# Everything below this line is probably okay.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    61
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    62
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    63
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    64
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    65
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    66
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    67
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    68
# CygWin autodetect.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    69
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    70
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    71
ifeq ($(strip $(cygwin)),autodetect)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    72
  ifneq ($(strip $(shell gcc -v 2>&1 |grep "cygwin")),)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    73
    cygwin := true
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    74
  else
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    75
    cygwin := false
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    76
  endif
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    77
endif
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    78
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    79
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    80
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    81
# Platform-specific binary stuff.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    82
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    83
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    84
ifeq ($(strip $(cygwin)),true)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    85
  # !!! FIXME
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    86
  build_dll := false
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    87
  # !!! FIXME
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    88
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    89
  ASM = nasmw
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    90
  EXE_EXT = .exe
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    91
  DLL_EXT = .dll
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    92
  STATICLIB_EXT = .a
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    93
  ASMOBJFMT = win32
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    94
  ASMDEFS = -dC_IDENTIFIERS_UNDERSCORED
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    95
  CFLAGS += -DC_IDENTIFIERS_UNDERSCORED
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    96
else
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    97
  ASM = nasm
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    98
  EXE_EXT =
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    99
  DLL_EXT = .so
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   100
  STATICLIB_EXT = .a
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   101
  ASMOBJFMT = elf
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   102
endif
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   103
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   104
ifeq ($(strip $(build_dll)),true)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   105
LIB_EXT := $(DLL_EXT)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   106
LDFLAGS += -shared
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   107
else
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   108
LIB_EXT := $(STATICLIB_EXT)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   109
endif
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   110
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   111
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   112
# General compiler, assembler, and linker flags.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   113
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   114
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   115
BINDIR := bin
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   116
SRCDIR := .
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   117
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   118
CFLAGS += $(use_asm) -I$(SRCDIR) -D_REENTRANT -fsigned-char -DPLATFORM_UNIX
13
4f98eb8bbabb fixed typo
Ryan C. Gordon <icculus@icculus.org>
parents: 11
diff changeset
   119
CFLAGS += -Wall -Werror -fno-exceptions -fno-rtti -ansi -pedantic
9
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   120
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   121
LDFLAGS += -lm
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   122
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   123
ifeq ($(strip $(debugging)),true)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   124
  CFLAGS += -DDEBUG -g -fno-omit-frame-pointer
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   125
  LDFLAGS += -g -fno-omit-frame-pointer
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   126
else
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   127
  CFLAGS += -DNDEBUG -O2 -fomit-frame-pointer
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   128
  LDFLAGS += -O2 -fomit-frame-pointer
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   129
endif
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   130
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   131
ASMFLAGS := -f $(ASMOBJFMT) $(ASMDEFS)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   132
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   133
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   134
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   135
# Source and target names.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   136
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   137
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   138
BASELIBNAME := physfs
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   139
MAINLIB := $(BINDIR)/$(strip $(BASELIBNAME))$(strip $(LIB_EXT))
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   140
18
bb03dd217a97 Changes for subdirs.
Ryan C. Gordon <icculus@icculus.org>
parents: 13
diff changeset
   141
MAINSRCS := physfs.c platform/unix.c archivers/dir.c
9
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   142
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   143
ifeq ($(strip $(use_archive_zip)),true)
18
bb03dd217a97 Changes for subdirs.
Ryan C. Gordon <icculus@icculus.org>
parents: 13
diff changeset
   144
MAINSRCS += archivers/zip.c
9
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   145
CFLAGS += -DPHYSFS_SUPPORTS_ZIP
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   146
endif
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   147
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   148
# Rule for getting list of objects from source
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   149
MAINOBJS1 := $(MAINSRCS:.c=.o)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   150
MAINOBJS2 := $(MAINOBJS1:.cpp=.o)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   151
MAINOBJS3 := $(MAINOBJS2:.asm=.o)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   152
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   153
MAINOBJS := $(foreach f,$(MAINOBJS3),$(BINDIR)/$(f))
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   154
MAINSRCS := $(foreach f,$(MAINSRCS),$(SRCDIR)/$(f))
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   155
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   156
CLEANUP = $(wildcard *.exe) $(wildcard *.obj) \
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   157
          $(wildcard $(BINDIR)/*.exe) $(wildcard $(BINDIR)/*.obj) \
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   158
          $(wildcard *~) $(wildcard *.err) \
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   159
          $(wildcard .\#*) core
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   160
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   161
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   162
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   163
# Rules.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   164
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   165
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   166
# Rules for turning source files into .o files
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   167
$(BINDIR)/%.o: $(SRCDIR)/%.cpp
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   168
	$(CC) -c -o $@ $< $(CFLAGS)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   169
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   170
$(BINDIR)/%.o: $(SRCDIR)/%.c
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   171
	$(CC) -c -o $@ $< $(CFLAGS)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   172
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   173
$(BINDIR)/%.o: $(SRCDIR)/%.asm
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   174
	$(ASM) $(ASMFLAGS) -o $@ $<
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   175
11
677e01f5109e Progress toward complete implementation continues...
Ryan C. Gordon <icculus@icculus.org>
parents: 9
diff changeset
   176
.PHONY: all clean distclean listobjs
9
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   177
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   178
all: $(BINDIR) $(MAINLIB)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   179
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   180
$(MAINLIB) : $(BINDIR) $(MAINOBJS)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   181
	$(LINKER) -o $(MAINLIB) $(LDFLAGS) $(MAINOBJS)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   182
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   183
$(BINDIR):
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   184
	mkdir -p $(BINDIR)
20
efdde0d21521 Implementation compiles and links with no actual archive support. No test
Ryan C. Gordon <icculus@icculus.org>
parents: 18
diff changeset
   185
	mkdir -p $(BINDIR)/archivers
18
bb03dd217a97 Changes for subdirs.
Ryan C. Gordon <icculus@icculus.org>
parents: 13
diff changeset
   186
	mkdir -p $(BINDIR)/platform
9
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   187
11
677e01f5109e Progress toward complete implementation continues...
Ryan C. Gordon <icculus@icculus.org>
parents: 9
diff changeset
   188
distclean: clean
677e01f5109e Progress toward complete implementation continues...
Ryan C. Gordon <icculus@icculus.org>
parents: 9
diff changeset
   189
9
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   190
clean:
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   191
	rm -f $(CLEANUP)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   192
	rm -rf $(BINDIR)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   193
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   194
listobjs:
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   195
	@echo SOURCES:
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   196
	@echo $(MAINSRCS)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   197
	@echo
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   198
	@echo OBJECTS:
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   199
	@echo $(MAINOBJS)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   200
	@echo
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   201
	@echo BINARIES:
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   202
	@echo $(MAINLIB)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   203
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   204
showcfg:
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   205
	@echo "Using CygWin   : $(cygwin)"
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   206
	@echo "Debugging      : $(debugging)"
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   207
	@echo "ASM flag       : $(use_asm)"
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   208
	@echo "Building DLLs  : $(build_dll)"
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   209
	@echo "Supports .ZIP  : $(use_archive_zip)"
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   210
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   211
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   212
# This section is pretty much just for Ryan's use to make distributions.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   213
#  You Probably Should Not Touch.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   214
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   215
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   216
# These are the files needed in a binary distribution, regardless of what
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   217
#  platform is being used.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   218
BINSCOMMON := LICENSE.TXT physfs.h
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   219
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   220
.PHONY: package msbins win32bins nocygwin
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   221
package: clean
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   222
	cd .. ; zip -9rz ./physfs-src-$(shell date +%m%d%Y).zip physfs -x "*CVS*" < physfs/FILEID.DIZ
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   223
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   224
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   225
ifeq ($(strip $(cygwin)),true)
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   226
msbins: win32bins
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   227
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   228
win32bins: clean all
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   229
	echo -e "\r\n\r\n\r\nHEY YOU.\r\n\r\n\r\nTake a look at README-win32bins.txt FIRST.\r\n\r\n\r\n--ryan. (icculus@linuxgames.com)\r\n\r\n" |zip -9rz ../physfs-win32bins-$(shell date +%m%d%Y).zip $(MAINLIB) $(EXTRAPACKAGELIBS) README-win32bins.txt
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   230
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   231
else
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   232
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   233
msbins: nocygwin
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   234
win32bins: nocygwin
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   235
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   236
nocygwin:
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   237
	@echo This must be done on a Windows box in the Cygwin environment.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   238
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   239
endif
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   240
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   241
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   242
# That's all, folks.
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   243
#-----------------------------------------------------------------------------#
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   244
1155788ccbe3 Initial add. Ways to go.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   245
# end of Makefile ...