diff --git a/Makefile.win32 b/Makefile.win32 index db216d4..5c4c4a8 100644 --- a/Makefile.win32 +++ b/Makefile.win32 @@ -1,37 +1,40 @@ -CC = gcc -CFLAGS = -Wall -O2 -I. -DWIN32 -BIN = UartSecureDFU +# Copyright (c) 2025 Jacob Eva (Liberated Embedded Systems) +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . -DEPS = crc32.h \ - delay_connect.h \ - dfu.h \ - dfu_serial.h \ - logging.h \ - slip_enc.h \ - uart_drv.h \ - uart_slip.h \ - zip.h \ - miniz.h \ - jsmn.h \ - Makefile +# This makefile is for GNU / Linux. -OBJS = crc32.o \ - delay_connect.o \ - dfu.o \ - dfu_serial.o \ - jsmn.o \ - logging.o \ - slip_enc.o \ - uart_win32.o \ - UartSecureDFU.o \ - uart_slip.o \ - zip.o +CC=gcc +CFLAGS=-DLOG_USE_COLOR -Wall -O2 -I. -DWIN32 -l crypto +LIB=librnode +SRCS=$(shell dir /b /s *.c *.h | findstr /v /i "\_linux.c$") +OBJS=$(patsubst %.c,%.o,$(SRCS)) +F_OBJS=$(notdir $(OBJS)) -%.o: %.c $(DEPS) - $(CC) $(CFLAGS) -c $< -o $@ +all: $(OBJS) + ar cr build/$(LIB).a -o $(F_OBJS) + mv *.o build -$(BIN): $(OBJS) - $(CC) $(OBJS) -o $(BIN) +%.o: %.c + $(CC) $(FLAGS) $< -c -clean: - rm -f $(BIN) $(OBJS) +debug: FLAGS+=-g +debug: all + +test: all + $(CC) tests/test.c -L build -l rnode -l tap -l crypto -l md -o build/librnode_test + +test-debug: debug + $(CC) tests/test.c -L build -l rnode -l tap -l crypto -l md -g -o build/librnode_test + +clean: + - rm -rf build + - mkdir build