summaryrefslogtreecommitdiffstats
path: root/Makefile_op
blob: 792653f69495f545aea6e57699d2e63ccb5bf92d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# equivalent to #define in c code
VERSION = 0.12.0
CC = gcc
CFLAGS = '-DVERSION="$(VERSION)"' -w -Os -s #size
#CFLAGS = -w -O3 -s
#CFLAGS = -w -g		#debug
SOURCES = 	op.c \
			common_functions.c \
			progP12.c \
			progP16.c \
			progP18.c \
			progP24.c \
			progEEPROM.c \
			progAVR.c \
			fileIO.c \
			deviceRW.c \
			I2CSPI.c \
			strings.c

OBJECTS = $(addsuffix .o, $(basename $(SOURCES)))

LDFLAG = -lrt

all: op

op : $(OBJECTS)
	@echo "\t LD $@"
	@$(CC) $(OBJECTS) -o op $(LDFLAG)
	@rm $(OBJECTS)

%.o : %.c
	@echo "\t CC $@"
	@$(CC) $(CFLAGS) -c $<

clean:
	@echo "\t CLEAN ALL"
	@rm -f op $(OBJECTS)

prefix	:= /usr/local
    
install: op
	@echo "\t Installing op"
	@test -d $(prefix) || mkdir $(prefix)
	@test -d $(prefix)/bin || mkdir $(prefix)/bin
	@install -m 0755 op $(prefix)/bin;

package:
	@echo "\t Creating op_$(VERSION).tar.gz"
	@mkdir op-$(VERSION)
	@cp *.c *.h gpl-2.0.txt Makefile readme utils/*.c op-$(VERSION)
	@tar -czf op_$(VERSION).tar.gz op-$(VERSION)
	@rm -rf op-$(VERSION)

.PHONY: all clean install package