summaryrefslogblamecommitdiffstats
path: root/Makefile_opgui
blob: cd0f5a34f1ca805841d276636b6272ee28498555 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                                 
                


                   
                                                                




                        

                                     
















                                                 



                                      
                           
    
                      






                  


                                         

         

                              

                                      

                                                                                    

      

                                           



                                                     


                                             

        
                                                   





                                                                                                          
# equivalent to #define in c code
VERSION = 0.12.2
CC = gcc
PREFIX = /usr/local

CFLAGS = '-DVERSION="$(VERSION)"' `pkg-config --cflags gtk+-3.0`
CFLAGS += -DOPGUI
CFLAGS += -Os -s #size
#CFLAGS += -O3 -s #speed
#CFLAGS += -g #debug

LDLAGS = `pkg-config --libs gtk+-3.0`

SOURCES = opgui.c \
	deviceRW.c \
	progP12.c \
	progP16.c \
	progP18.c \
	progP24.c \
	progEEPROM.c \
	progAVR.c \
	fileIO.c \
	I2CSPI.c \
	coff.c \
	icd.c \
	strings.c \
	resources.c
#	progP32.c \

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

# Check if we are running on windows
UNAME := $(shell uname)
ifneq (, $(findstring _NT-, $(UNAME)))
	LDLAGS += -mwindows
else
	LDLAGS += -lrt
endif
	

# Targets
all: opgui

opgui : $(OBJECTS)
	@echo "\t LD $@"
	@$(CC) -o $@ $(OBJECTS) $(LDLAGS)
	@rm $(OBJECTS) resources.c

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

resources.c: resources.xml opgui.glade
	@echo "\t GLIB $@"
	@glib-compile-resources resources.xml --target=resources.c --generate-source

clean:
	@echo "\t CLEAN ALL"
	@rm -f opgui $(OBJECTS) resources.c
	
install: all
	#test -d $(prefix) || mkdir $(prefix)
	#test -d $(prefix)/bin || mkdir $(prefix)/bin
	@echo "\t Installing opgui"
	@mkdir -p $(PREFIX)/bin
	@install -m 0755 opgui $(PREFIX)/bin;
	
package:
	@echo "\t Creating opgui_$(VERSION).tar.gz"
	@mkdir opgui-$(VERSION)
	@cp *.c *.h *.png gpl-2.0.txt Makefile readme resources.xml opgui.glade style.css opgui-$(VERSION)
	@tar -czf opgui_$(VERSION).tar.gz opgui-$(VERSION)
	@rm -rf opgui-$(VERSION)

.PHONY: all clean install package