Revamp Makefile
This commit is contained in:
parent
fd1af14450
commit
adec31317a
3 changed files with 26 additions and 16 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,6 @@
|
|||
build/
|
||||
build-win/
|
||||
build-tmp/
|
||||
raylib/
|
||||
*.amd64
|
||||
*.exe
|
||||
|
|
30
Makefile
30
Makefile
|
@ -2,9 +2,7 @@ OUTNAME = mtycoon
|
|||
|
||||
CFLAGS = -O0 -g -Wall -Wextra -I ./raylib/include -pipe
|
||||
#linux
|
||||
#LDFLAGS = -static -L./raylib/lib -lraylib -lm
|
||||
#windows
|
||||
LDFLAGS = -static -lraylib -lgdi32 -lwinmm -lm
|
||||
LDFLAGS = -L./raylib/lib -lraylib -lm
|
||||
|
||||
CC = gcc
|
||||
OUTPUT = "${OUTNAME}.amd64"
|
||||
|
@ -12,30 +10,40 @@ OUTPUT = "${OUTNAME}.amd64"
|
|||
BUILD_DIR = build
|
||||
SRC_DIR = src
|
||||
|
||||
OBJS = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(wildcard $(SRC_DIR)/*.c))
|
||||
OBJS = $(patsubst $(SRC_DIR)/%.c,build-tmp/%.o,$(wildcard $(SRC_DIR)/*.c))
|
||||
|
||||
all: | builddir build
|
||||
${CC} ${CFLAGS} -o ${OUTPUT} ${OBJS} ${LDFLAGS}
|
||||
${CC} ${CFLAGS} -o ${OUTPUT} ${wildcard $(BUILD_DIR)/*.o} ${LDFLAGS}
|
||||
|
||||
$(BUILD_DIR)/%.o : $(SRC_DIR)/%.c
|
||||
windef:
|
||||
$(eval OUTPUT = "$(OUTNAME).exe")
|
||||
$(eval BUILD_DIR = build-win)
|
||||
$(eval LDFLAGS = -static -lraylib -lgdi32 -lwinmm -lm)
|
||||
|
||||
build-tmp/%.o : $(SRC_DIR)/%.c
|
||||
${CC} -c $< -o $@ ${CFLAGS}
|
||||
|
||||
build: $(OBJS)
|
||||
mv $(OBJS) $(BUILD_DIR)/
|
||||
rm -rf build-tmp
|
||||
|
||||
builddir:
|
||||
- mkdir $(BUILD_DIR)
|
||||
mkdir build-tmp
|
||||
- mv $(wildcard $(BUILD_DIR)/*.o) build-tmp/
|
||||
|
||||
win: | clean all
|
||||
mv $(OUTPUT) "$(OUTNAME).exe"
|
||||
|
||||
win: | windef all
|
||||
|
||||
testwin: win
|
||||
./"$(OUTNAME).exe"
|
||||
./$(OUTPUT)
|
||||
|
||||
test: all
|
||||
./${OUTPUT}
|
||||
|
||||
clean:
|
||||
- rm -rf ${BUILD_DIR}
|
||||
- rm $(OUTPUT) "$(OUTNAME).exe"
|
||||
- rm -rf build-win
|
||||
- rm -rf build-tmp
|
||||
- rm "$(OUTNAME).amd64" "$(OUTNAME).exe"
|
||||
|
||||
.PHONY: all test clean win testwin prodwin
|
||||
|
|
10
src/ui.c
10
src/ui.c
|
@ -85,28 +85,28 @@ Widget main_menu = {
|
|||
.buttons = {
|
||||
{.box = {520,220,240,40},
|
||||
.color_0 = WHITE,
|
||||
.color_1 = PINK,
|
||||
.color_1 = BLACK,
|
||||
.color_txt = BLACK,
|
||||
.txt = "New game",
|
||||
.handler = main_menu_new_game
|
||||
},
|
||||
{.box = {520,270,240,40},
|
||||
.color_0 = WHITE,
|
||||
.color_1 = PINK,
|
||||
.color_1 = BLACK,
|
||||
.color_txt = GRAY,
|
||||
.txt = "Load game",
|
||||
.handler = NULL
|
||||
},
|
||||
{.box = {520,320,240,40},
|
||||
.color_0 = WHITE,
|
||||
.color_1 = PINK,
|
||||
.color_1 = BLACK,
|
||||
.color_txt = GRAY,
|
||||
.txt = "Settings",
|
||||
.handler = NULL
|
||||
},
|
||||
{.box = {520,400,240,40},
|
||||
.color_0 = WHITE,
|
||||
.color_1 = PINK,
|
||||
.color_1 = BLACK,
|
||||
.color_txt = BLACK,
|
||||
.txt = "Exit",
|
||||
.handler = main_menu_exit
|
||||
|
@ -127,7 +127,7 @@ void worker_widget_do_event(Widget *widget, Game *game, MTEvent event){
|
|||
Widget worker_widget = {
|
||||
.box = {.x = 40, .y = 40, .width = 300, .height = 600},
|
||||
.draw = worker_widget_draw,
|
||||
.do_event = NULL,
|
||||
.do_event = worker_widget_do_event,
|
||||
.capt_flags = CF_Mouse,
|
||||
.buttons = {
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue