2 # Should be fairly portable for the various *nix systems. The rules
3 # themselves shouldn't need to be changed; only the variables may need to
6 # Automatically default to a release build.
12 VERSION
= $(shell cat VERSION
)
13 GIT_BUILD
= $(shell git describe
)
24 SOURCES
= src
/console
/arguments.c src
/calculator.c src
/commands.c \
25 src
/console
/error.c src
/console
/help.c src
/history.c src
/operators.c \
26 src
/parser.c src
/console
/main.c src
/stack.c src
/tokens.c \
28 OBJECTS
= $(subst .c
,.o
,$(subst $(SRCDIR
),$(OBJDIR
),$(SOURCES
)))
30 # Git command to make a distribution tarball.
31 GIT_ARCHIVE
= git archive
--format
=tar --prefix=rpn-
$(VERSION
)/ HEAD | \
32 bzip2
>rpn-
$(VERSION
).
tar.bz2
34 # Installation directory
35 INSTALL_DIR
= /usr
/bin
37 # Executable generation directory
42 CFLAGS
= -c
-s
-Wall
-O2
-DRPN_CONSOLE
-DRPN_LONG_DOUBLE
-D_GNU_SOURCE \
43 -DHASH_FUNCTION
=HASH_JSW
-DGIT_BUILD
="\"$(GIT_BUILD)\"" -Isrc
/include \
48 CFLAGS
= -c
-Wall
-g
-DRPN_CONSOLE
-DRPN_LONG_DOUBLE
-DRPN_DEBUG
-D_GNU_SOURCE \
49 -DHASH_FUNCTION
=HASH_JSW
-DGIT_BUILD
="\"$(GIT_BUILD)\"" -Isrc
/include \
53 TARGET
= $(BIN_DIR
)/rpn
55 # General rule for compiling.
56 $(OBJDIR
)%.o
: $(SRCDIR
)%.c
57 @echo Compiling
$(notdir $<)
58 @
$(CC
) $< $(CFLAGS
) $@
60 # rule to make the program
62 @echo Linking
$(TARGET
)...
63 @
$(CC
) $(OBJECTS
) $(LFLAGS
) $@
65 # make the program by default
69 # rule to clean-up the objects and the target, if they exist
72 @echo Cleaning objects and executables...
76 # rule to install program
79 $(CP
) $< $(INSTALL_DIR
)
81 # rule to make tarball for distribution.
86 # rule to make documentation
92 PSP_TARGET
= EBOOT.PBP
93 PSP_MAKEFILE
= Makefile.psp
95 # Call the PSP makefile to do the work.
96 $(PSP_TARGET
): $(PSP_MAKEFILE
)
99 # Make the executable.
106 @
$(MKF
) $(PSP_MAKEFILE
) clean
110 @
$(MKF
) $(PSP_MAKEFILE
) install
113 WII_MAKEFILE
= Makefile.wii
117 @
$(MKF
) $(WII_MAKEFILE
)
120 wii-clean
: $(WII_MAKEFILE
)
121 @
$(MKF
) $(WII_MAKEFILE
) clean
124 wii-run
: $(WII_MAKEFILE
)
125 @
$(MKF
) $(WII_MAKEFILE
) run
128 GUI_TARGET
= $(BIN_DIR
)/rpn-gui
129 GUI_MAKEFILE
= Makefile.gui
131 $(GUI_TARGET
): $(GUI_MAKEFILE
)
139 @
$(MKF
) $(GUI_MAKEFILE
) clean
141 # An easter egg, just for the hell of it.