Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 360 | f9daq | 1 | CFLAGS = -DMRP  | 
        
| 2 | #  | 
        ||
| 3 | # $Id: Makefile 1249 2014-02-22 20:21:40Z ales.bardorfer $  | 
        ||
| 4 | #  | 
        ||
| 5 | # (c) Red Pitaya http://www.redpitaya.com  | 
        ||
| 6 | #  | 
        ||
| 7 | # Trigger  | 
        ||
| 8 | # Trigger project source file.  | 
        ||
| 9 | #  | 
        ||
| 10 | # make CROSS_COMPILE=arm-linux-gnueabi- clean all  | 
        ||
| 11 | # on PC and move to Red Pitaya:  | 
        ||
| 12 | # scp trig root@172.16.255.27:/tmp  | 
        ||
| 13 | #  | 
        ||
| 14 | # This project file is written for GNU/Make software. For more details please  | 
        ||
| 15 | # visit: http://www.gnu.org/software/make/manual/make.html  | 
        ||
| 16 | # GNU Compiler Collection (GCC) tools are used for the compilation and linkage.  | 
        ||
| 17 | # For the details about the usage and building please visit:  | 
        ||
| 18 | # http://gcc.gnu.org/onlinedocs/gcc/  | 
        ||
| 19 | #  | 
        ||
| 20 | |||
| 21 | # Versioning system  | 
        ||
| 22 | VERSION ?= 0.00-0000  | 
        ||
| 23 | REVISION ?= devbuild  | 
        ||
| 24 | |||
| 25 | # List of compiled object files (not yet linked to executable)  | 
        ||
| 26 | OBJS = sockserv.o fpga_osc.o calib.o daq.o  | 
        ||
| 27 | # List of raw source files (all object files, renamed from .o to .c)  | 
        ||
| 28 | SRCS = $(subst .o,.c, $(OBJS)))  | 
        ||
| 29 | |||
| 30 | # Executable name  | 
        ||
| 31 | TARGET=sockserv  | 
        ||
| 32 | |||
| 33 | # GCC compiling & linking flags  | 
        ||
| 34 | CFLAGS += -g -std=gnu99 -Wall -Werror  | 
        ||
| 35 | CFLAGS += -DVERSION=$(VERSION) -DREVISION=$(REVISION)  | 
        ||
| 36 | CFLAGS += -DDEBUG  | 
        ||
| 37 | CFLAGS += -I/opt/redpitaya/include  | 
        ||
| 38 | CFLAGS += -L/opt/redpitaya/lib  | 
        ||
| 39 | #LDLIBS = -lm -lpthread -lrp  | 
        ||
| 40 | # Red Pitaya common SW directory  | 
        ||
| 41 | SHARED=/opt/redpitaya  | 
        ||
| 42 | |||
| 43 | # Additional libraries which needs to be dynamically linked to the executable  | 
        ||
| 44 | # -lm - System math library (used by cos(), sin(), sqrt(), ... functions)  | 
        ||
| 45 | LIBS=-lm -lpthread -lrp  | 
        ||
| 46 | |||
| 47 | # Main GCC executable (used for compiling and linking)  | 
        ||
| 48 | CC=$(CROSS_COMPILE)gcc  | 
        ||
| 49 | # Installation directory  | 
        ||
| 50 | INSTALL_DIR ?= .  | 
        ||
| 51 | |||
| 52 | # Makefile is composed of so called 'targets'. They give basic structure what  | 
        ||
| 53 | # needs to be execued during various stages of the building/removing/installing  | 
        ||
| 54 | # of software package.  | 
        ||
| 55 | # Simple Makefile targets have the following structure:  | 
        ||
| 56 | # <name>: <dependencies>  | 
        ||
| 57 | # <command1>  | 
        ||
| 58 | # <command2>  | 
        ||
| 59 | # ...  | 
        ||
| 60 | # The target <name> is completed in the following order:  | 
        ||
| 61 | # - list od <dependencies> finished  | 
        ||
| 62 | # - all <commands> in the body of targets are executed succsesfully  | 
        ||
| 63 | |||
| 64 | # Main Makefile target 'all' - it iterates over all targets listed in $(TARGET)  | 
        ||
| 65 | # variable.  | 
        ||
| 66 | all: $(TARGET)  | 
        ||
| 67 | |||
| 68 | # Target with compilation rules to compile object from source files.  | 
        ||
| 69 | # It applies to all files ending with .o. During partial building only new object  | 
        ||
| 70 | # files are created for the source files (.c) which have newer timestamp then  | 
        ||
| 71 | # objects (.o) files.  | 
        ||
| 72 | %.o: %.c version.h  | 
        ||
| 73 | $(CC) -c $(CFLAGS) $< -o $@  | 
        ||
| 74 | |||
| 75 | # Makefile target with rules how to link executable for each target from $(TARGET)  | 
        ||
| 76 | # list.  | 
        ||
| 77 | $(TARGET): $(OBJS)  | 
        ||
| 78 | $(CC) -o $@ $^ $(CFLAGS) $(LIBS)  | 
        ||
| 79 | |||
| 80 | # Version header for traceability  | 
        ||
| 81 | version.h:  | 
        ||
| 82 | cp $(SHARED)/include/redpitaya/version.h .  | 
        ||
| 83 | |||
| 84 | # Clean target - when called it cleans all object files and executables.  | 
        ||
| 85 | clean:  | 
        ||
| 86 | rm -f *.o  | 
        ||
| 87 | |||
| 88 | # Install target - creates 'bin/' sub-directory in $(INSTALL_DIR) and copies all  | 
        ||
| 89 | # executables to that location.  | 
        ||
| 90 | install: clean  | 
        ||
| 91 | mkdir -p $(INSTALL_DIR)/bin  | 
        ||
| 92 | install $(TARGET) $(INSTALL_DIR)/bin  | 
        ||
| 93 | install redpitaya_tcpsocket.service /etc/systemd/system  | 
        ||
| 94 | #enable server at board boot  | 
        ||
| 95 | systemctl enable redpitaya_tcpsocket  | 
        ||
| 96 | #mkdir -p $(INSTALL_DIR)/src/utils/$(TARGET)  | 
        ||
| 97 | #cp * $(INSTALL_DIR)/src/utils/$(TARGET)/  | 
        ||
| 98 | #-rm `find $(INSTALL_DIR)/src/tools/$(TARGET)/ -iname .svn` -rf  | 
        ||
| 99 | #install tcpsocket_manager /opt/redpitaya/www/apps  | 
        ||
| 100 | cp -r tcpsocket /opt/redpitaya/www/apps  | 
        ||
| 101 | make -C /opt/redpitaya/www/apps/tcpsocket  |