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 -o
47 CFLAGS
= -c
-Wall
-g
-DRPN_CONSOLE
-DRPN_LONG_DOUBLE
-DRPN_DEBUG
-D_GNU_SOURCE \
48 -DHASH_FUNCTION
=HASH_JSW
-DGIT_BUILD
="\"$(GIT_BUILD)\"" -Isrc
/include -o
51 TARGET
= $(BIN_DIR
)/rpn
53 # General rule for compiling.
54 $(OBJDIR
)%.o
: $(SRCDIR
)%.c
55 @echo Compiling
$(notdir $<)
56 @
$(CC
) $< $(CFLAGS
) $@
58 # rule to make the program
60 @echo Linking
$(TARGET
)...
61 @
$(CC
) $(OBJECTS
) $(LFLAGS
) $@
63 # make the program by default
67 # rule to clean-up the objects and the target, if they exist
70 @echo Cleaning objects and executables...
74 # rule to install program
77 $(CP
) $< $(INSTALL_DIR
)
79 # rule to make tarball for distribution.
84 # rule to make documentation
90 PSP_TARGET
= EBOOT.PBP
91 PSP_MAKEFILE
= Makefile.psp
93 # Call the PSP makefile to do the work.
94 $(PSP_TARGET
): $(PSP_MAKEFILE
)
97 # Make the executable.
104 @
$(MKF
) $(PSP_MAKEFILE
) clean
108 @
$(MKF
) $(PSP_MAKEFILE
) install
111 WII_MAKEFILE
= Makefile.wii
115 @
$(MKF
) $(WII_MAKEFILE
)
118 wii-clean
: $(WII_MAKEFILE
)
119 @
$(MKF
) $(WII_MAKEFILE
) clean
122 wii-run
: $(WII_MAKEFILE
)
123 @
$(MKF
) $(WII_MAKEFILE
) run
126 GUI_TARGET
= $(BIN_DIR
)/rpn-gui
127 GUI_MAKEFILE
= Makefile.gui
129 $(GUI_TARGET
): $(GUI_MAKEFILE
)
137 @
$(MKF
) $(GUI_MAKEFILE
) clean