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