aboutsummaryrefslogtreecommitdiff
path: root/robot/makefile
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-26 22:16:55 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-26 22:16:55 +0200
commit3fd5d966f3b0cabd9f6931bc1ca416408f9e101c (patch)
tree88607b1cd901b78b0892a0a85580993f7cb2c57d /robot/makefile
parentedfa25fcd8edad43998f50a2144d30a6f966c1c8 (diff)
compile sim on windows without errors
Diffstat (limited to 'robot/makefile')
-rw-r--r--robot/makefile11
1 files changed, 6 insertions, 5 deletions
diff --git a/robot/makefile b/robot/makefile
index 85ed2e3..a913bd7 100644
--- a/robot/makefile
+++ b/robot/makefile
@@ -6,18 +6,19 @@ MCU ?= atmega168
AVRDUDE_DEVICE ?= m168
PORT ?= /dev/ttyACM0
+SIM = true
CFLAGS=-g -Wall $(DEVICE_SPECIFIC_CFLAGS) -Os
LDFLAGS=-Wl,-gc-sections -Wl,-relax
-all: $(if $(SIM), a.out, out.hex)
+include ../shared/os.mk
+all: $(if $(SIM), $(TARGET), out.hex)
SOURCES := $(filter-out sim.c, $(wildcard *.c))
HEADERS := $(filter-out sim.h, $(wildcard *.h))
include ../shared/makefile
# simulation
-# SIM = true
CFLAGS += $(if $(SIM), -DW2_SIM, -mcall-prologues -mmcu=$(MCU))
LDFLAGS += $(if $(SIM), , -lpololu_$(DEVICE))
PREFIX := $(if $(SIM), , avr-)
@@ -31,15 +32,15 @@ CC=$(PREFIX)gcc
OBJ2HEX=$(PREFIX)objcopy
clean::
- rm -f *.o out.hex a.out
+ rm -f *.o out.hex $(TARGET)
-a.out: $(OBJECTS)
+$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) $(CFLAGS) $(LDFLAGS)
.o:
$(CC) -c $(CFLAGS) $<
-out.hex: a.out
+out.hex: $(TARGET)
$(OBJ2HEX) -R .eeprom -O ihex $< $@
$(info build $(BUILD_STR) complete)