summaryrefslogtreecommitdiffstats
path: root/commandline/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'commandline/Makefile')
-rw-r--r--commandline/Makefile66
1 files changed, 31 insertions, 35 deletions
diff --git a/commandline/Makefile b/commandline/Makefile
index 5c8f81a..e05f7a6 100644
--- a/commandline/Makefile
+++ b/commandline/Makefile
@@ -1,46 +1,42 @@
-# Name: Makefile
-# Project: Automator
-# Author: Christian Starkjohann
-# Creation Date: 2006-02-01
-# Tabsize: 4
-# Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH
-# License: Proprietary, free under certain conditions. See Documentation.
-# This Revision: $Id: Makefile 281 2007-03-20 13:22:10Z cs $
-# Please read the definitions below and edit them as appropriate for your
-# system:
+# Makefile initially writen for Little-Wire by Omer Kilic <omerkilic@gmail.com>
+# Later on modified by ihsan Kehribar <ihsan@kehribar.me> for Micronucleus bootloader application.
-# Use the following 3 lines on Unix and Mac OS X:
-USBFLAGS= `libusb-config --cflags`
-USBLIBS= `libusb-config --libs`
-EXE_SUFFIX=
+CC=gcc
-# Use the following 3 lines on Windows and comment out the 3 above:
-#USBFLAGS=
-#USBLIBS= -lhid -lusb -lsetupapi
-#EXE_SUFFIX= .exe
+# FIXME: Need to add OSX stuff
+ifeq ($(shell uname), Linux)
+ USBFLAGS = `libusb-config --cflags`
+ USBLIBS = `libusb-config --libs`
+ EXE_SUFFIX =
+ OSFLAG = -D LINUX
+else
+ USBFLAGS = -I C:\MinGW\include
+ USBLIBS = -L C:\MinGW\lib -lusb
+ EXE_SUFFIX = .exe
+ OSFLAG = -D WIN
+endif
-CC= gcc
-CXX= g++
-CFLAGS= -O2 -Wall $(USBFLAGS)
-LIBS= $(USBLIBS)
-ARCH_COMPILE=
-ARCH_LINK=
+LIBS = $(USBLIBS)
+INCLUDE = library
+CFLAGS = $(USBFLAGS) $(LIBS) -I$(INCLUDE) -O -g $(OSFLAG)
-OBJ= main.o usbcalls.o
-PROGRAM= bootloadHID$(EXE_SUFFIX)
+LWLIBS = opendevice micronucleus_lib littleWire_util
+EXAMPLES = micronucleus
-all: $(PROGRAM)
+.PHONY: clean library
-$(PROGRAM): $(OBJ)
- $(CC) $(ARCH_LINK) $(CFLAGS) -o $(PROGRAM) $(OBJ) $(LIBS)
+all: library $(EXAMPLES)
+library: $(LWLIBS)
-strip: $(PROGRAM)
- strip $(PROGRAM)
+$(LWLIBS):
+ @echo Building library: $@...
+ $(CC) $(CFLAGS) -c library/$@.c
-clean:
- rm -f $(OBJ) $(PROGRAM)
+$(EXAMPLES): $(addsuffix .o, $(LWLIBS))
+ @echo Building example: $@...
+ $(CC) $(CFLAGS) -o $@$(EXE_SUFFIX) examples/$@.c $^ $(LIBS)
-.c.o:
- $(CC) $(ARCH_COMPILE) $(CFLAGS) -c $*.c -o $*.o
+clean:
+ rm -f $(EXAMPLES)$(EXE_SUFFIX) *.o *.exe